Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ Explain code Console Input Failures Console input via the cin command specifies a required data type. If the input is of improper type the
C++
Explain code
Console Input Failures Console input via the cin command specifies a required data type. If the input is of improper type the program may perform erratically. o When cin receives an input of proper type a goodbit state is set for the cin command, which indicates that input was valid. o When cin receives an input of improper type a failbit state is set for the command. It is possible to check for this failbit state from the last cin command using the fail function: int i; cout > i; if (cin. fail()) cout > i; if (! (cin >> i)) // can be read as "if cin is not good" cout = 80 >= 70 >= 60 >= 0 D F 4) Repeat Steps 2 and 3 for each number in the list. 5) Print out the results which shows the counts for each grade. The following functions should be defined/implemented and called in main() int getNumberOfStudents(); //make sure to validate number of students void Initialize (int& countGradea, int& count GradeB, int& countGradec, int& count GradeD, int & countGradeF); void get NumberGrade (float& grade); //make sure to valid the grade. void classifyGrades (float grade, int& countGradeA, int& countGrades, int& countGradec, int& countGradeD, int& countGradeF); void print Results (int countGradeA, int count GradeB, int countGradec, int countGrade D, int countGradeF); Example Output: GRADE STATICS Please enter number of Students: -2 Invalid input. Please re-enter. Please enter number of Students: 5 Please enter a number of grade (0 100) : 95.5 Please enter a number of grade (0 100): 79.98 Please enter a number of grade (0 100): 88 Please enter a number of grade (0 100): 199 Invalid grade! Please re-enter. Please enter a number of grade (0 - 100): 60 Please enter a number of grade (0 100): 59.95 GRADES NUMBER OF STUDENTS A B D 1 1 1 1 1 F PROGRAM ENDING. GOOD BYEStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started