Last updated 2 years ago
for
char ch; for(int i = 1; i <= 10; i++){ cout << "Iteration " << i << endl; cout << "repeat iteration (y/n): "; cin >> ch; if(ch == 'y') i--; }
Sometimes you might want to work with the same value of the iterator. Example: See solution for