#include<stdio.h>int main(){goto state;state ;printf("let's play a game");char c;c =getchar();fflush(stdin);}--------------------配置: mingw5 - CUI Debug, 编译器类型: MinGW--------------------检查文件依赖性...正在编译 C:\Users\hust\Documents\C-Free\Temp\未命名1.cpp...[Error] C:\Users\hust\Documents\C-Free\Temp\未命名1.cpp:5: error: `state' was not declared in this scope[Error] C:\Users\hust\Documents\C-Free\Temp\未命名1.cpp:4: error: label `state' used but not defined[Warning] C:\Users\hust\Documents\C-Free\Temp\未命名1.cpp:11:2: warning: no newline at end of file构建中止 未命名1: 2 个错误, 1 个警告
3 回答

ibeautiful
TA贡献1993条经验 获得超5个赞
#include<stdio.h>
int main()
{
goto state;
state ://用冒号
printf("let's play a game");
char c;
c =getchar();
fflush(stdin);
}
//goto尽量不要用

慕侠2389804
TA贡献1719条经验 获得超6个赞
在软件设计的过程中有一天就是尽量不用goto语句,有极大的不可控性,所以建议趁早放弃它,养成好习惯用for 和while循环简练易懂,你的state没有定义
- 3 回答
- 0 关注
- 183 浏览
添加回答
举报
0/150
提交
取消