pascal编程:谁做了好事?有ABCD四位学生,其中一位做了好事,但不知道是谁。

2025-02-28 08:35:23
推荐回答(3个)
回答1:

a,b,c,d:boolean;
a=1; b=0; c=0; d=0; //如果是a
if ((not (not a))and(c)and(d)and(not d))or ((not a)and(not c)and(d)and(not d))or
((not a)and(c)and(not d)and(not d))or((not a)and(not c)and(d)and(not (not d)))
then writeln('a');
a=0; b=1; c=0; d=0;//如果是b
if ((not (not a))and(c)and(d)and(not d))or ((not a)and(not c)and(d)and(not d))or
((not a)and(c)and(not d)and(not d))or((not a)and(not c)and(d)and(not (not d)))
then writeln('a'); //和上面一样,可以放到函数里面
a=0; b=0; c=1; d=0;
...
a=0; b=0; c=0; d=1;
...
这是我的想法,太久没写pascal,不太标准

回答2:

输入输出格式什么样

回答3:

选C 就是C