#include <iostream>
using namespace std;
int main ()
{
//Defining variables that will be used during code. Where c stands for credit hours and g stands for the corresponding grade
float c1, c2, c3, c4, c5;
char g1, g2, g3, g4, g5;
//Asking for input from user
cout <<"Please enter the number of credit hours for each class followed by the grade obtained in each class:";
// Input is in the following form: 3 4 3 4 3 A C B A B.
cin >> oc1>> c2>> c3>> c4>> c5>> g1>> g2>> g3>> g4>> g5;
//Defining the the grade inputs A, B, C, D, and F in terms of a numerical value.
if (g1 == 'A') g1=4;
if (g1 == 'B') g1=3;
if (g1 == 'C') g1=2;
if (g1 == 'D') g1=1;
if (g1 == 'F') g1=0;
if (g2 == 'A') g2=4;
if (g2 == 'B') g2=3;
if (g2 == 'C') g2=2;
if (g2 == 'D') g2=1;
if (g2 == 'F') g2=0;
if (g3 == 'A') g3=4;
if (g3 == 'B') g3=3;
if (g3 == 'C') g3=2;
if (g3 == 'D') g3=1;
if (g3 == 'F') g3=0;
if (g4 == 'A') g4=4;
if (g4 == 'B') g4=3;
if (g4 == 'C') g4=2;
if (g4 == 'D') g4=1;
if (g4 == 'F') g4=0;
if (g5 == 'A') g5=4;
if (g5 == 'B') g5=3;
if (g5 == 'C') g5=2;
if (g5 == 'D') g5=1;
if (g5 == 'F') g5=0;
//Calculating and printing the final GPA.
cout << "Your GPA is:"<< ((c1 * g1)+(c2 * g2)+(c3 * g3)+(c4 * g4)+(c5 * g5))/(c1+c2+c3+c4+c5)<<"\n";
return 0;
}