跳转语句 goto的语法格式:
goto 标识;
标识:
作用为直接跳转到标识所在地方
尽量不要在代码中使用,否则会使结构错乱
下面是一个实例:
#include<iostream>
using namespace std;
int main() {
//goto语句
cout << "1、xxxxx" << endl;
cout << "2、xxxxx" << endl;
goto FLAG;
cout << "3、xxxxx" << endl;
cout << "4、xxxxx" << endl;
FLAG:
cout << "5、xxxxx" << endl;
system("pause");
return 0;
}
输出结果为
直接跳转到了语句5