我想在c编程中编写一个代码,提示人们回答布尔值yes
或no
问题,然后相应地运行该操作。而不是IF
或switch
。C编程布尔表达式
include <stdlib.h>
include <stdio.h>
int main()
{
int children;
int age;
printf("please enter your age");
scanf("%d", age);
printf("are you married?, please enter y for Yes and n for No"\n\n);
scanf("%s", mstatus);
if (mstatus is y or Y)
{
printf("how many children do you have: \n\n")
scanf("%d", children)
}
return 0;
}
请去重读基础。你的代码充满了问题。 –
Quote:而不是IF或开关?你能解释一下吗? – 4386427
缩进你的代码。这只是许多其他问题之一。 –