C++ for statement loop nesting
#include <iostream> using namespace std; int main()/*from w w w . j a v a 2s .c om*/ { const int MAXI = 5; const int MAXJ = 4; int i, j; for (i = 1; i <= MAXI; i++) // start of outer loop { cout << "\ni is now " << i << endl; for (j = 1; j <= MAXJ; j++) // start of inner loop cout << " j = " << j; // end of inner loop } // end of outer loop cout << endl; return 0; }