Question
Using c++, how can i get all example outputs with variations of the code added below the images. #include #include using namespace std; int getNumberOfStudents(){
Using c++, how can i get all "example outputs" with variations of the code added below the images.
#include
#include
using namespace std;
int getNumberOfStudents(){
double n;
while(true){
cout
cout
cin >> n;
cin.clear();
cin.ignore(100,' ');
if ( !int(n) || n != int(n) || n
cout
cin.clear();
cin.ignore(100,' ');
}
else if (n
cout
cout
cout
cin.clear();
cin.ignore(100,' ');
}
else{
return n;
}}}
void initialize(int &countGradeA, int &countGradeB, int &countGradeC, int &countGradeD, int &countGradeF){
countGradeA = 0;
countGradeB = 0;
countGradeC = 0;
countGradeD = 0;
countGradeF = 0;
}
void classifyGrade(double grade, int &countGradeA, int &countGradeB, int &countGradeC, int &countGradeD, int &countGradeF){
if (grade >= 90)
countGradeA++;
else if (grade >= 80)
countGradeB++;
else if (grade >= 70)
countGradeC++;
else if (grade >= 60)
countGradeD++;
else if (grade
countGradeF++;
}
void printResults(int countGradeA, int countGradeB, int countGradeC, int countGradeD, int countGradeF){
cout
cout
cout
cout
cout
cout
cout
cout
cout
}
void getNumberGrade(int& grade)
{
while(true)
{
cout
cin >> grade;
cin.clear();
cin.ignore(100,' ');
if ( !int(grade) || grade!=int(grade) || grade = 101 ){
cout
}
else
break;
}
}
int main(){
int grade;
int countGradeA, countGradeB, countGradeC, countGradeD, countGradeF;
initialize(countGradeA, countGradeB, countGradeC, countGradeD, countGradeF);
double n = getNumberOfStudents();
for (int i = 0; i getNumberGrade(grade); classifyGrade(grade,countGradeA, countGradeB, countGradeC, countGradeD, countGradeF); } printResults(countGradeA, countGradeB, countGradeC, countGradeD, countGradeF); return 0; }
Step 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