Question: When scanf encounters an error, the invalid data are left in the input stream, sometimes making it impossible to continue. Write a program that reads
When scanf encounters an error, the invalid data are left in the input stream, sometimes making it impossible to continue. Write a program that reads three pieces of numeric data. If an error is detected (return value not EOF but less than 3), flush the erroneous data. Then test the function by entering numeric data and alphabetical data in different sequences. Post your program, as well as your test input and output.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
