C++
Question 1
1. 1: for(int var=0; var<10; ++var)
2: {
3: cout << "Hi there" << endl;
4: }
5: cout << "After loop ends" << endl;
What is the value of var on line 5?
|
|
|
11 |
|
|
|
0 |
|
|
|
9 |
|
|
|
10 |
Question 2
1. How many times does this loop iterate?
1: int x = -5;
2: while( x > 4 )
3: {
4: cout << "hi there" << endl;
5: }
6: cout << "done!" << endl;
|
|
|
8 |
|
|
|
0 |
|
|
|
1 |
|
|
|
2 |