Counter as Test III
#include <iostream> using namespace std; // Counting loop example. int main() { int cnt; cout << "How many? "; cin >> cnt; for(int i = cnt; i--; ) { cout << "cnt = " << i << endl; } }

For loop version of the previous. Uses the fact that C++ allows the increment to be omitted.