fig02_26.cpp
来自「经典vc教程的例子程序」· C++ 代码 · 共 22 行
CPP
22 行
// Fig. 2.26: fig02_26.cpp
// Using the break statement in a for structure
#include <iostream.h>
int main()
{
// x declared here so it can be used after the loop
int x;
for ( x = 1; x <= 10; x++ ) {
if ( x == 5 )
break; // break loop only if x is 5
cout << x << " ";
}
cout << "\nBroke out of loop at x of " << x << endl;
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?