#include <iostream>
using namespace std;
int main()
{
cout << endl << "the loop break when i = 5" << endl;
for(int i = 1; i < 10; i ++){
if (i == 5) break;
cout << i << endl;
}
cout << endl << "the loop skip 5 with continue" << endl;
for(int i = 1; i < 10; i ++){
if (i == 5) continue;
cout << i << endl;
}
return 0;
}
No comments:
Post a Comment