Please send questions to
st10@humboldt.edu .
/*
Contract: describe_grade: char -> void
Purpose: prints to the screen on its own line
a prose description for the
<grade> expressed as a char.
If an unrecognized grade is given,
prints "Unrecognized Grade"
Examples: describe_grade('A') prints to the screen:
Excellent
describe_grade('b') prints to the screen:
Very Good
describe_grade('C') prints to the screen:
Acceptable
describe_grade('d') prints to the screen:
Marginal
describe_grade('F') prints to the screen:
Insufficient
describe_grade('g') prints to the screen:
Unrecognized Grade
*/
#include <iostream>
#include "describe_grade.h" // here because named constants
// are declared there
using namespace std;
void describe_grade (char grade)
{
if ((grade == 'a') || (grade == 'A'))
{
cout << A_DESCR << endl;
}
else if ((grade == 'b') || (grade == 'B'))
{
cout << B_DESCR << endl;
}
else if ((grade == 'c') || (grade == 'C'))
{
cout << C_DESCR << endl;
}
else if ((grade == 'd') || (grade == 'D'))
{
cout << D_DESCR << endl;
}
else if ((grade == 'f') || (grade == 'F'))
{
cout << F_DESCR << endl;
}
else
{
cout << OTHER_DESCR << endl;
}
}