Re: [问卦] 用if else叙述反对死刑但这个必须死

楼主: applebg (数学不及格)   2022-08-23 13:38:29
※ 引述《pchion2002 (阿我就怕被骂阿)》之铭言:
: 各位大师下午好
: 昨天两名警察领了盒饭
: 造就了有金句产生
: 从程式语言来看下面这句话
: “我反对死刑但这一定要判死”
: 判断式要怎么写才能成立?
//judges do not sentence people to death
bool death_sentence = False;
//assume that no policemen die
bool kill_policemen = False;
//if no policemen die, the judge would say the following
while(!death_sentence){
printf("judge: be a good person, you shall be pardoned");
//if a policeman dies, the judge will stop pardoning people
//and sentence people to death
if(kill_policemen == True){
printf("May God have mercy upon your soul,
because I won't!");
death_sentence = True;
break;
}
}

Links booklink

Contact Us: admin [ a t ] ucptt.com