#include "stdafx.h"
#include <iostream>
using namespace std;
int getScore(int& score);
int calculateGrade(int score);
int _tmain()
{
int courseScore;
cout << " Line 1: Based on the course score"
<< " this program computes the "
<< "course grade." << endl;
getScore(courseScore);
int calculateGrade(courseScore);
system ("pause");
return 0;
}
int getScore(int& score)
{
int num;
cout << "Line 4: Enter course score: ";
cin >> num;
cout << endl << "Line 6: Course score is "
<< num << endl;
return num;
}
int calculateGrade(int& cScore)
{
cout << "Line 7: Your grade for the course is ";
if (cScore >= 90)
cout << "A." << endl;
else if (cScore >= 80)
cout << "B." << endl;
else if (cScore >= 70)
cout << "C." << endl;
else if (cScore >= 60)
cout << "D." << endl;
else
cout << "F." << endl;
}
This is what I have. The book says "The function printGrade in Example is written as a void function to compute and output the course grade. The course score is passed as a parameter to the funcion printGrade. Rewrite the function printGrade as a value-returning function so that it computes and returns the course grade. I get the error error C4716: 'calculateGrade' : must return a value what do I have wrong as I'm not seeing it.