how to use a for loop in c++ code example Example: for c++ for (int i = 0; i < 7; i++) { cout << i << endl; }