You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
362 B
Plaintext
20 lines
362 B
Plaintext
// There are only 'for', 'while', and 'do while'
|
|
|
|
// For loop - Outputs "0 1 2 3 4 5 6 7 8 9"
|
|
for( int i=0; i<10; i++ ) {
|
|
std::cout << i << " ";
|
|
}
|
|
|
|
// While loop - Outputs "0 1 2 3 4 5 6 7 8 9"
|
|
int i = 0;
|
|
while( i < 10 ) {
|
|
std::cout << i << " ";
|
|
i++;
|
|
}
|
|
|
|
// While loop - Outputs "0 "
|
|
int i = 0;
|
|
do {
|
|
std::cout << i << " ";
|
|
}while( i<0 );
|