gpt4 book ai didi

c - 我在 "expected ‘;’ token 之前收到错误 ‘!’”

转载 作者:太空宇宙 更新时间:2023-11-04 07:11:03 26 4
gpt4 key购买 nike

<分区>

int menu () {
char choice [5];
int i;
int c;

printf("Welcome to your own personal tamaguchi!");

printf("\n 1.Name your tamaguchi.\n");
printf("\n 2.Check health and age.\n");
printf("\n 3.Feed tamaguchi.\n");
printf("\n 4. Exercise with tamaguchi.\n");
printf("Let tamaguchi sleep.n");
printf("\n 5. Close program.\n");

printf("Choose action: ");
scanf("%s", choice);
printf("\n");

for (i=0; choice[i]! = '\0'; i++){
if(!isdigit(choice[i]))
return -1;
}

c = atoi(choice);
return c;
}

他们说问题出在 ! 的地方 choice[i]!='\0'

我已经包含了标准输入输出、字符串、时间和标准库。我不知道我做错了什么,如果你能看到错误请告诉我?

谢谢。

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com