// Design and run a program that takes a numerical score and outputs a letter grade.
// Specific numerical scores and letter grades are listed below:
// 90-100 = Grade A
// 80-89 = Grade B
// 70-79 = Grade C
// 60-69 = Grade D
// 0-59 = Grade F
// In this program, create two void functions titled getScore and printGrade with an int argument.
// The function getScore should have a Reference parameter and printGrade should have a Value parameter.
// The function getScore will prompt the user for the numerical score, get the input from the user, and print the numerical score.
// The function printGrade will calculate the course grade and print the course grade.
// (Be careful and note that the assignment requires you to input the grade into getScore and not directly into the main function.)
// Do not forget to put in the proper prompts and appropriate output messages.
// (Note: This program is a natural for use of the switch command, but if?else structures will also work.)
#include <iostream>
using namespace std;
void getScore();
void printGrades();
int score;
int &grade = score;
void getScore (int&)
{
cout << "Enter what score you got out of a hundred on the test?\n";
cout << "And I will tell you the letter grade: ";
cin >> score;
}
void printGrades(int)
{
if (grade >= 0 , grade <= 59)
{
cout << "You got a " << score << " that is an F.";
}
else if (grade >= 60 , grade <= 69)
{
cout << "You got a " << score << " that is a D.";
}
else if (grade >= 70 , grade <= 79)
{
cout << "You got a " << score << " that is a C.";
}
else if (grade >= 80 , grade <= 89)
{
cout << "You got an " << score << " that is a B.";
}
else if (grade >= 90 , grade <= 100)
{
cout << "You got a " << score << " that is an A.";
}
}
int main()
{
getScore(score);
printGrades(grade);
return 0;
}