Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

10. (TCO 2) A user inputs his name in response to a prompt for a numeric value.

ID: 3657890 • Letter: 1

Question

10. (TCO 2) 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 the failure and cin.ignore() to clear the failure. D) Use cin.ignore() to detect and clear the failure.

Explanation / Answer

so simple (c)