2: // Looping with while
3:
4: #include <iostream.h>
5:
6: int main()
7: {
8: int counter = 0;
9:
10: while(counter < 5)
11: {
12: counter++;
13: cout << "Looping! ";
14: }
15:
16: cout << "\nCounter: " << counter << ".\n";
17: return 0;
18: }
Output: Looping! Looping! Looping! Looping! Looping!
Counter: 5.