C++中goto关键字的使用
基础知识
语法:
goto 标记;
(如果标记存在,执行到goto语句时,会跳转到标记的位置)
标记:
测试源代码
/*
时间:2021.02.10
内容:goto语句的使用
*/
/*
语法:
goto 标记;
如果标记的名称存在,执行到goto语句时,会跳转到标记的位置
标记:
*/
#include <iostream>
using namespace std;
int main(void)
{
cout << "1" << endl;
goto FLAG;
cout << "2" << endl;
FLAG:
cout << "3" << endl;
system("pause");
return 0;
}
// KEEP CALM AND CARRY ON