我是 C 编程的新手,我正在尝试书中的一段代码。当我尝试构建和运行它时,我收到无法运行程序的错误和警告。不知道为什么。我的代码是逐字写的。我也在为 PC 使用 codeBlocks。
#include <stdio.h>
int main()
{
char choice;
printf("Are you filing a single, joint or ");
printf("Married return (s, j, m)? ");
do
{
scanf(" %c ", &choice);
switch (choice)
{
case ('s') : printf("You get a $1,000 deduction.\n");
break;
case ('j') : printf("You geta 1 $3,000 deduction.\n");
break;
case ('m') : printf("You geta $5,000 deduction.\n");
break;
default : printf("I don't know the ");
printf("option %c.\n, choice");
printf("Try again.\n");
break;
}
}while ((choice != 's') && (choice != 'j') && (choice != 'm');
return 0;
}