course average???

HI!!!
I'm trying to make a program to get the course average and the grade letter; the programe should ask for the last name, midterm grade and final grade,and get the couse average and the grade letter as the a final output.

the midterm test = 50% and the final test = 50% of the course average.

i've tried:
courseaverage= midtermgrade+fianlgrade
cout<<courseaverage<<endl;

but did not work, can anyone tell me what do i have to do to get the course average and the letter grade??

This is what i got so far:

#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
char LastName[20];
int midtermGrade;
double finalGrade;
double courseAverage;
char letterGrade(double numericgrade);

cout << "Enter a Last Name: ";
cin >> LastName;
cout << endl;
cout << "Midterm Grade: ";
cin >> midtermGrade;
cout << endl;
cout << "Final Grade Score: ";
cin >> finalGrade;


system("PAUSE");
return EXIT_SUCCESS;
}

Uh... You don't know how to calculate an average?
avgval=sigma(i=1,n)(vali)/n
Last edited on
closed account (SNbpX9L8)
hey in simple terms average=(grade1+grade2+grade3)/amount of grades (3)
http://www.cplusplus.com/forum/articles/6046/

average = (midtermGrade + finalGrade) / 2;
To get the average, follow Zaita's advice.

To get the letter grade, try an if-else control statement. (USE THE <= AND >= SIGNS, LUKE...)
Be careful. midtermGrade is an Integer and finalGrade is double, so Zaitas formula works, but if you change finalGrade to integer, you have to do

average = (midtermGrade + finalGrade) / (double) 2;

or the calculation will return an integer, wich means, the number will be rounded down.
Aren't operands always converted to the type of the biggest operand?
Topic archived. No new replies allowed.