If the computer is expecting a numeric value and gets a string, the computer program will generate garbage numbers and will not operate correctly. By using a boolean variable and cin.fail(), we can check to see if the user has input the correct data.
Code Download
CPPW32T8.zip