如何用c语言编一道选择题 (选a是正确的,选b是错误的)

有两个选项a.first b.second
2024-10-31 08:44:42
推荐回答(1个)
回答1:

#include

int main()
{
char choose;
printf("a.first\n");
printf("b.second\n");
scanf("%c",&choose);
switch(choose)
{
case 'a':
case 'A':
printf("you are right!\n");
break;
case 'b':
case 'B':
printf("you are wrong!\n");
break;
default:
printf("you can only choose a(A) or b(B)\n");
break;
}
return 0;
}