#include<iostream>
using namespace std;
int main()
{
int grade;
int hours;
int points;
int totalpoints;
int possiblepoints;
cout << "Enter your letter grade followed by the corresponding credit hours:\n ";
cout << "When Finished entering grades, type j or J for your grade \n\n";
while (grade != 'j' || grade != 'J')
// Read grade and hours
cin >> grade;
if (grade == 'A'|| grade == 'a')
points = 4, cin >> hours;
else if (grade == 'B' || grade == 'b')
points = 3, cin >> hours;
else if (grade == 'C' || grade == 'c')
points = 2, cin >> hours;
else if (grade == 'D' || grade == 'd')
points = 1, cin >> hours;
else if (grade == 'F' || grade == 'f')
points = 0, cin >> hours;
else if (grade == 'j' || grade == 'J')
{ points =0;
hours = 0;
}
else
{ grade =0;
points =0;
hours =0;
cout << "Please enter a valid grade" << endl;
//Calculate Total Points
totalpoints += (points * hours);
possiblepoints += hours * 4 ;
}
return 0;
}
No comments:
Post a Comment