Mega Code Archive

 
Categories / C++ Tutorial / Operators Statements
 

Counter-controlled repetition

#include <iostream> using std::cout; using std::endl; int main() {    int counter = 1;     while ( counter <= 10 )     {           cout << counter << " ";       counter++;     }     cout << endl;     return 0;  } 1 2 3 4 5 6 7 8 9 10