Sorry, I don't live in English language area, so I have looked what is the GPA. I've found it:
http://www.back2college.com/gpa.htm
So, you need to store the courses and grades. It is ok, because you have done it.
1 2 3 4 5
|
class CoursesAndGrades{ // This is where I get stuck
public:
string title;
char grades;
};
|
(Instead of 'public' you could make set or get function.)
I will continue.
You can use array or vector to hold the data:
for example:
1 2 3 4 5 6 7 8 9
|
...
class CoursesAndGrades{ // This is where I get stuck
string title
char grades
};
...
private:
CoursesAndGrades arrayOfCourses[10]; // Here you can hold max 10 Courses.
|
Other storing:
vector<CoursesAndGrades> vectorOfCourses;
http://www.dreamincode.net/forums/showtopic33631.htm
http://www.cplusplus.com/reference/stl/vector/
I advise to use vector.
1 2 3 4 5
|
class CollegeStudent{
...
private:
vector<CoursesAndGrades> vectorOfCoursesAndGrades;
}
|
So you need an add function:
1 2 3 4 5 6 7 8 9
|
void CollegeStudent::add(string title, char grade)
{
CoursesAndGrades *pCaG = new CoursesAndGrades();
pCaG->title = title;
pCaG->grade = grade;
vectorOfCoursesAndGrades.push_back(pCaG);
}
|
// ! in the destructor you have to destroy the elements of the vector!!!!
1 2 3 4 5 6 7 8 9
|
~CollegeStudent::CollegeStudent()
{
CoursesAndGrades *pCaG;
for ( int i = 0; i < vectorOfCoursesAndGrades.size(); i++)
{
vectorOfCoursesAndGrades.pop_back(pCaG);
delete pCaG;
}
}
|
After that you need a get function which gets the data;
Of course my code is not ready.
write if you stuck somewhere.