What is the problem with this bit of code? On most systems, you don’t get a chance to enter the letter. Why?

```
cout << “Enter a number:\n”;
int number;
cin > number;
cout << “Enter a letter;\n”;
char symbol;
cin.get(symbol);
cout << number<< “ “ < Dialog: (Computer output is bolded.)
Enter a number:
21
Now enter a letter:
21


On some systems, you won’t get a chance to enter the letter. On others, you don’t get the ‘A’ in the variable symbol. What happens is that you enter a number, followed by a newline to get the system to accept the number. That, too is a character that is read by the cin.get(symbol). That, being satisfied, continues to the output statement.

Computer Science & Information Technology

You might also like to view...

State the scope of each of the following entities:

a) the variable randomNumbers. b) the variable die1. c) the method rollDice. d) the method main. e) the variable sumOfDice.

Computer Science & Information Technology

A(n) ____________________ group is a bound control that is often used when a limited number of mutually exclusive values are available for a field.

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

Computer Science & Information Technology

If a work is in the public domain, then:

a. you can secure a free license through the Public Domain Institute (PDI). b. you can license it with a $25 processing fee through the Library of Congress. c. you can use the material without a license or permission. d. you can use the material through the public domain contract, where some percentage of the profit is disbursed to non-profit arts organizations. e. it is publicly owned and thus cannot be reproduced for any purpose.

Computer Science & Information Technology

Which of the following would be used to correct a ghost image on a laser printer?

A. Replace the drum B. Replace the fuser C. Clean the printhead D. Replace the cartridges

Computer Science & Information Technology