Image

Imagetransmogrify wrote in Imagecpp

gpa program

i'm supposed to make a program that will calculate a person's gpa for my com sci class, but i'm having problems. any help would be much appreciated.

#include
[Error: Irreparable invalid markup ('<iostream.h>') in entry. Owner must fix manually. Raw contents below.]

i'm supposed to make a program that will calculate a person's gpa for my com sci class, but i'm having problems. any help would be much appreciated.
<lj-cut text="my work thusfar">
#include <iostream.h>
float convert (char grade)
{
if (grade='A')
return 4.0;
else if (grade='B')
return 3.0;
else if (grade='C')
return 2.0;
else if (grade='D')
return 1.0;
else if (grade='F')
return 0.0;
}
void main ()
{
float gpa, hours = 0.0, gradepoints = 0.0, credits;
char grade;
int i, courses;

cout << "How many courses did you take\n";
cin >> courses;

for (i=1; i<=courses; i++)
{
cout << "What was your grade?\n";
cin >> grade;

cout << "How many credits was the class?\n";
cin >> credits;

gradepoints += credits * convert(grade);
hours += credits;

}

gpa = gradepoints / hours;
cout << "Your GPA is " << gpa << endl;
}
</lj-cut>

cross posted in <lj comm="coders_haven">