goto语句
作用:可以无条件跳转语句
语法:goto 标记(如果标记的名称存在,执行到goto语句时,会跳转到标记的位置)
示例:
#include
using namespace std;
int main(){
cout<<“1.xxx”<<endl;
cout<<“2.xxx”<<endl;
goto FLAG;
cout<<“3.xxx”<<endl;
FLAG:
cout<<“000.xxx”<<endl;
system(“pause”);
return 0;
}
输出:
1.xxx
2.xxx
000.xxx
总结:在程序中不建议使用goto语句,以免造成程序流程混乱