For loops -- Examples
n
int n = 0;
n
for ( ; n < 5; n++)
n
cout << n;
// print: 0 1 2 3 4
n
int n = 0;
n
for ( ; n < 5; ) {
n
cout << n;
n
n = n + 1;
n
}
n
cout << “Hello !” << endl;
n
// print: 0 1 2 3 4 Hello
n
for ( ; ; )
{
// infinite loop
n
statements;
n
}
n