C++ goto语句

4.3.3 goto语句

作用:可以无条件跳转语句

语法:goto 标记:

解释:如果标记的名称存在,执行到 goto 语句使,会跳转到标记的位置

示例:

#include <iostream>
using namespace std;

int main() {

	// goto 语句

	cout << "1、XXXX" << endl;

	cout << "2、XXXX" << endl;

	goto FLAG;

	cout << "3、XXXX" << endl;

	cout << "4、XXXX" << endl;

	FLAG:

	cout << "5、XXXX" << endl;

	system("pause");

	return 0;
}
posted @ 2021-12-28 19:39  萨塔妮娅  阅读(268)  评论(0)    收藏  举报