"sscolon" <ss*********@yahoo.com> wrote in message
news:d6******************************@localhost.ta lkaboutprogramming.com...
You didn't say what's wrong or what help you want, so I'm just guessing that you want to know
what's wrong with your code.
# include <iostream>
Also:
#include <string>
using std::cout;
using std::cin;
using std::endl;
Also:
using std::string;
enum GradeType {A, B, C, D, F};
struct StudentRec
{
string firstName;
string lastName;
float average;
int grade;
int finalExam;
GradeType courseGrade;
};
int main
Should be: int main()
{
StudentRec FirstStudent;
You are not using FirstStudent anywhere.
StudentRec student;
int grade
Should be: int grade;
cout << " Enter your First Name:" << endl;
cin >> firstName;
You have not defined a variable 'firstName'. Did you mean student.firstName?
cout << "Enter your percentage:" << endl;
cin >>percentage;
You have not defined a variable 'percentage'. All variables you use have to be defined somewhere
first.
cout << " name " << " score " << " Final Grade " << endl;
cin >> student.finalExam;
grade = student.finalExam + studentGrade;
You have not defined a variable 'studentGrade'.
if (grade >=90)
student.courseGrade = A;
else if (grade >=80)
student.courseGrade = B;
else if (grade >= 70)
student.courseGrade = D;
else if (grade>= 60)
student.courseGrade = C;
else
cout << grade << "F" << endl;
return 0;
}
Also, to make it work as you described earlier, you will need a collection of StudentRecs (e.g.,
a std::vector<StudentRec>) and you will need a loop in your code (a 'do' or a 'while') so that
the program will keep asking for details of more students until the exit value is entered. But
you can add that later. Get the code working for one student first.
If you have more questions, reply to a post in this thread instead of starting a new one. All
posts relating to the same problem should be together.
DW