我想在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
縮進你的代碼。這只是許多其他問題之一。 –