I don't understand what I am doing wrong here. I am trying to quickly write this program so that I can use it to test a flowchart diagram that I made earlier. When the output comes up on the console "Enter a course name" and I put any input in and hit Enter, the program skips the other output and input sections that I have coded in.
#include <iostream>
#include <string>
using namespace std;
int main()
{
double totalGradePoints = 0.0;
double totalUnitHours = 0.0;
double tripValue = 0.0;
char courseName;
double unitHours = 0;
char letterGrade;
double gradePoints = 0;
double gradePointAverage;
while(tripValue < 5)
{
cout << "Enter A Course Name." << endl;
cin >> courseName;
cout << "Enter Unit Hours for the Course." << endl;
cin >> unitHours;
cout << "Enter a Letter Grade. (Please enter in UpperCase Letters.)" << endl;
cin >> letterGrade;
switch (letterGrade)
{
case 'A':
gradePoints = unitHours * 4.0;
break;
case 'B':
gradePoints = unitHours * 3.0;
break;
case 'C':
gradePoints = unitHours * 2.0;
break;
case 'D':
gradePoints = unitHours * 1.0;
break;
case 'F':
gradePoints = unitHours * 0.0;
break;
default:
cout << "Your Letter Grade was not valid. Please Restart the program." << endl;
}
totalGradePoints = totalGradePoints + gradePoints;
totalUnitHours = totalUnitHours + unitHours;
cout << "Course Name: " << courseName << endl;
cout << "Letter Grade: " << letterGrade << endl;
cout << "Unit Hours: " << unitHours << endl;
cout << "Grade Points Earned for This Course: " << gradePoints << endl;
tripValue++;
}
gradePointAverage = totalGradePoints / totalUnitHours;
cout << "Total Grade Points: " << totalGradePoints << endl;
cout << "Total Credit Hours Attempted: " << totalUnitHours << endl;
cout << "Overall GPA: " << gradePointAverage << endl;
return 0;
}