A user inputs his name in response to a prompt for a


1. A user inputs his name in response to a prompt for a numeric value. The subsequent cin statement tries to get a numeric value and store it into an integer variable. How does a program detect this input error and clear it?

A. The cin input stream is broken, the application must be restarted.

B. cin.fail() detects a failure and cin.clear() clears the failure.

C. Use cin.fail() to detect a failure and cin.ignore() to clear the failure

D. Use cin.ignore() to detect and clear the failure.

2. Which statement outputs a double value in a field of five characters with two difits after the decimal point?

A. cout<<5chars<<2digits<<1.23;

B. cout <

C. cout<

D. cout>>setw(2)>>setprecision(5)>>1.23;

Request for Solution File

Ask an Expert for Answer!!
Other Subject: A user inputs his name in response to a prompt for a
Reference No:- TGS0647834

Expected delivery within 24 Hours