a. What is the output if the input line consists of the characters ABCDE?
b. Rewrite the code so that it works properly.
8. Does the following program segment need any priming reads? If not, explain why. If so, add the input statement(s) in the proper place. (letter is of type char.)
while (cin)
{
while (letter != \n)
{
cout << letter;
cin.get(letter);
}
cout << endl;
cout << Another line read << endl;
cin.get(letter);
}
9. Write the loop invariant for the following loop. (sum and count are of type int.)
sum = 0;
count = 0;
while (count < 22)
{
sum = sum + count;
count++;
}
10. What sentinel value would you choose for a program that reads telephone numbers as integers?