So I'm creating a program that implements several classes representing a school, and its students and courses. I'm running into an issue in School.cc where the addTaken() finds the student object with the given student number and the course object with the given course code, and then creates a new Taken object with the found student and course objects and adds it to the back of the Taken collection which is studentCoursePairs[].
The problem is the variable numTaken never increments despite having the '++'. It seems to always stay at 0. If numTaken is 0, the loop immediately stops (as 0 < 0 is false) and numTaken is never incremented for this reason. I was wondering if anyone knows how to fix this?
Since numTaken is always 0 it won't let me print anything in the Taken collection out.