/***************************************************
Grading
A school tracks grades as A, B, C, D or E (not F).
A students GPA is a number between 0 and 4, which
you calculate by averaging the grades - an A is
given 4 points, down to an E which is given 0 points.
Write a program that reads in 4 letter grades (a
student's first semester) and prints out his GPA.
***************************************************/
#include <iostream>
using namespace std;
int main()
{
// Read in four grades
cout << "Enter four grades: ";
char g1, g2, g3, g4;
cin >> g1 >> g2 >> g3 >> g4;
// Compute weights for the four grades
int w1, w2, w3, w4;
w1 = 'E' - g1;
w2 = 'E' - g2;
w3 = 'E' - g3;
w4 = 'E' - g4;
// Compute GPA
double a;
a = double(w1 + w2 + w3 + w4)/4.0;
// Print out GPA
cout << "GPA is " << a << endl;
return 0;
}