To attack a problem like this, read the assignment and make notes of the classes that you will need. When you're done, go back through it again to see if you've missed anything. Once you have everything you need, convert your notes to header files. Then implement the code.
For example
Create an array of student records (at least 15) |
class Student
constexpr int NumStudents = 20;
Student students[NumStudents];
Question: can you use a vector<> instead of an array?
put all the related student records information in an array |
// populate the array. Return the number of students inserted?
int populateStudents(students);
Student ID(Axxxxxxxx), Name, Address and average of test scores and a Pointer for Test Scores (at least 10 scores). |
So class Student has
string ID;
string Name;
string Address;
double averageScore;
int *scores;
Question: how will you store the number of scores? Can you use a vector instead of a pointer?
Question: if you have to store scores with a pointer then you need to store the number of scores, Also you need a copy constructor and assignment operator to copy the values.
Display the student records in the array (do not display pointers). |
operator << (ostream &, const Student &) to print one student. Then a simple
loop to print the array
Push all student records from the array to a static stack |
Need a static stack:
class Stack
Student values[20];
size_t top; // index of top of stack
Student &pop;
bool push(const Student &);
private:
Student values[20];
Pop 5 student records from the stack and display the popped records. |
Do it in main()
Pop 5 student records from the stack and display the popped records. |
Do it in main()
Display the remaining student records in the static stack. |
Do it in main().
That's the first pass. In the second pass you should be able to make notes of what goes into main(). You might even write a main() function with nothing but comments at this point and fill in the code later.