Thanks! Now all I have to do, I think is to change my if statement for r. It thinks a student is still enrolled even when using l to unroll a student...
Remember that a = 0assigns a value to the variable a and a == 0compares a with 0.
This:
1 2 3 4 5
elseif (rlc == 'l') //to leave a student
{
studCourse.course::getEnrollYN() == 0; // This has no effect
cout << "The student is no longer enrolled.";
}
does nothing. You need a function that actually sets the variable enrollYN to something. Either this or you use it directly:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
if (studCourse.enrollYN == 1) // Note
{
cout << "There is already a student enrolled.";
}
else
{
cout << "Please enter the surname of the new student: ";
cin >> sur;
cout << ". Please enter their enrollment number: ";
cin >> enr;
}
}
elseif (rlc == 'l') //to leave a student
{
studCourse.enrollYN = 0; // Note
cout << "The student is no longer enrolled.";
}