On most systems, you don’t get a chance to enter the letter when the code given below is run. Write two different code fragments that repair the problem.

```
cout <<“Enter a number:\n”;
int number;
cin >> number;
cout <<“Enter a letter;\n”;
char symbol;
cin.get(symbol);
cout < ```
Dialog: (Computer output is bolded.)
Enter a number:
21 Now enter a letter:
21
On my system, like many systems, one doesn’t get a chance to type the letter.
What will be an ideal response?

```
#include
using namespace std;
int main()
{
cout << "Enter a number:\n";
int number;
cin >> number;
cout << "Enter a letter;\n";
char symbol;
cin.ignore(1000, '\n);
cin.get(symbol);
}
/* Computer output is bolded:
```
The line cin >> symbol; in the problem’s code, could be replaced by the
two lines: cin.ignore(1000, ;\n;); cin.get(symbol);The output is
identical

Computer Science & Information Technology

You might also like to view...

With ____, distinct highlight areas appear on the surface of an object.

A. Plastic Shading B. Wireframe Shading C. Diffuse Shading D. No Shading

Computer Science & Information Technology

To accept changes made to a contact, click the ____ button.

A. Address Book B. Save & Close C. Forward D. Delete

Computer Science & Information Technology