好吧,我有一个实验室要做功课,我想知道是否有人可以帮助我解决这个问题。程序一直说我的变量已损坏。如果有人可以帮助我,那就太好了。顺便说一句,不介意这些问题哈哈。
int main (void)
{
char answer;
printf("welcome to the celebrity look alike game. You will be asked 5 yes or no questions. To answer please either put a y for yes or an n for no");
printf("\nQuestion 1: Do you have brown eyes?");
scanf("%1s", &answer);
if (answer=='y')
{printf("\nQuestion 2:Do you have white hair?");
scanf("%1s", &answer);
if (answer=='y')
printf("\nQuestion 3:Is your height around 5 feet 10 inches?");
scanf("%1s", &answer);
if (answer=='y')
printf("\nQuestion 4:Are you a slim man?");
scanf("%1s", &answer);
if (answer=='y')
printf("\nQuestion 5: Do you dress well?");
scanf("%1s", &answer);
if (answer=='y');
printf("You really look like Matt Leblanc!");}
else printf("Sorry, you do not look like this celebrity.");
return 0;
}