What will the following program segment do?


int counter = 1;


do
{
cout << counter << " ";
} while ( ++counter <= 10 );

a. Print the numbers 1 through 11.
b. Print the numbers 1 through 10.
c. Print the numbers 1 through 9.
d. Cause a syntax error.

b. Print the numbers 1 through 10.

Computer Science & Information Technology

You might also like to view...

The complicated version of the loop instruction shows that the loop uses a counter variable named ___________________.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

Which of the following segments is a proper way to call the method readData four times?

a. ``` double k = 0.0; while (k != 4) { readData(); k = k + 1; } ``` b. ``` int i = 0; while (i <= 4) { readData(); i = i + 1; } ``` c. ``` int i = 0; while (i < 4) { readData(); } ``` d. ``` while (i < 4) { readData(); i = i + 1; } ```

Computer Science & Information Technology