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

This loop ends when the counter reaches zero, since the zero is treated as false, while the larger values are treated as true.