Re: [問卦] 用if else敘述反對死刑但這個必須死

作者: oxlittle (牛牛)   2022-08-23 15:43:39
※ 引述《pchion2002 (阿我就怕被罵阿)》之銘言:
: 各位大師下午好
: 昨天兩名警察領了盒飯
: 造就了有金句產生
: 從程式語言來看下面這句話
: 「我反對死刑但這一定要判死」
: 判斷式要怎麼寫才能成立?
std::maps <string,string> dpp_lists; //Should init.
const bool opinion_for_death = True;
string prisoner_name;
cin >> prisoner_name;
if( dpp_lists.find(prisoner_name) != dpp_lists.end()){
//Delete by 數位中介法
exit(0);
}
else if( IsPrisonerKillPolice(prisoner_name) ){
if( IsAbnormal(prisoner_name){ //思覺失調 ..etc
cout << "Probation?" << endl;
}
else if( QueryPoll("Taiwan") > 0.5 ){ //民調領先
cout << "Prisoner go to jail forever." << endl;
}
else if( QueryPoll("Taiwan") <= 0.5){ //民調落後
cout << "Do execution now." << endl;
}
else{
cerr << "Should not happen. Program error" << endl;
exit( -1 );
}
}
else{
//TODO
}

Links booklink

Contact Us: admin [ a t ] ucptt.com