break(略)
continue(略)
goto语句
可以无条件跳转语句,如果标记的名称存在,执行到goto语句时,会跳转到标记的位置
最好不要乱用goto,只要了解一下他的存在
#include <iostream>
using namespace std;
int main(){
cout << "1.xxxxxx" << endl;
cout << "2.xxxxxx" << endl;
goto FLAG;
cout << "3.xxxxxx" << endl;
FLAG:
cout << "4.xxxxxx" << endl;
cout << "5.xxxxxx" << endl;
return 0;
}
输出:
1.xxxxxx
2.xxxxxx
4.xxxxxx
5.xxxxxx