The last function in the program calculateGrade is supposed to be a value return
ID: 3620845 • Letter: T
Question
The last function in the program calculateGrade is supposed to be a value returning function. It's supposed to print the letter grade associacted with the course score.#include <iostream>
using namespace std;
void getScore(int& score);
int calculateGrade(int cscore);
int main ()
{
int courseScore;
cout<<"Line 1: Based on the course score, this program "
<<"computes the course grade."<<endl;
getScore(courseScore);
calculateGrade(courseScore);
cin.get();
return 0;
}
void getScore(int& score)
{
cout<<"Line 4: Enter course score--> ";
cin>>score;
cin.get();
cout<<endl<<" Course score is "
<<score<<endl;
}
int calculateGrade(int cscore)
{
cout<<"Your grade for the course is ";
if(cscore >= 90)
return 'A';
else if(cscore >= 80)
return 'B';
else if(cscore >= 70)
return 'C';
else if(cscore >= 60)
return 'D';
else
return 'F';
return cscore;
}
Explanation / Answer
please rate - thanks you were never writing the grade and it should be a character, not an integer also that final return cscore is not neededRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.