#include <iostream>
#include <cstdlib>
using std::cout;
using std::endl;
int main()
{
for (int i = 0; i < 9; i++)
{
cout << i << endl;
if (i == 4)
break;
else
continue;
}
system("pause");
return 0;
}
运行结果:
在if else结构中break和continue可以作用于for循环