Just a note, were not using arrays or functions, other than main. We've only covered the basics and started to get into <iomanip> and the stuff thats in that liabrary. Thanks in advance.

#include <iostream>
using namespace std;

void main ()
{
	const double A = 4.0;
	const double B = 3.0;
	const double C = 2.0;
	const double D = 1.0;
	const double F = 0.0;
	double LetterGrade_1 = 0, LetterGrade_2 = 0, CreditHours_1 = 0; 
	double TotalPoints = 0, TotalCreditHours = 0, CreditHours_2 = 0, GPA = 0;

	cout << "Please enter letter grade of first class --> ";
	cin >> LetterGrade_1;
	cout << endl;

	cout << "Please enter number of credit hours for first class --> ";
	cin >> CreditHours_1;
	cout << endl;

	cout << "Please enter letter grade for second class --> ";
	cin >> LetterGrade_2;
	cout << endl;

	cout << "Please enter number of credit hours for second class --> ";
	cin >> CreditHours_2;
	cout << endl << endl;

	TotalPoints = (LetterGrade_1 * CreditHours_1) + (LetterGrade_2 * CreditHours_2);
	TotalCreditHours = CreditHours_1 + CreditHours_2;
	GPA = TotalPoints / TotalCreditHours;

	if (GPA < 2.0)
	{
		cout << "You are doing poorly." << endl << endl;
	}

	else if (GPA >= 3.5)
	{
		cout << "Congratulations, doing good." << endl << endl;
	}
}
Comments
Code Tags On First Post :)

Hmmm, I'm going to guess (since you didn't mention what the problem was) that it's skipping to the bottom of everything after you input the letter. Yeah. The problem is that you are doing a cin >> type double (yeah, LetterGrade_1 is a double, not a char) so when you type in a letter, and it tries to read it into a variable that is a double.... whoopsie. Try it when you input numbers.... is the result different?

This article has been dead for over six months. Start a new discussion instead.