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
You might also like to view...
Why is it important to push security of systems to DevOps teams?
What will be an ideal response?
The type of organization
What will be an ideal response?
_____ types are character strings that follow certain rules for format and content.
Fill in the blank(s) with the appropriate word(s).
An owner number in the OWNER table at Alexamara Marina consists of ____ uppercase letters followed by a two-digit number.
A. 2 B. 3 C. 4 D. 5