(almost solved) Constructors/Destructors Student enroling Program

Pages: 12
Thanks! that's helped a lot!

But the destructor still activates after typing in an l or a c. I want it to activate only when something other than r l or c is typed.
But the destructor still activates after typing in an l or a c. I want it to activate only when something other than r l or c is typed.
Then write it so:

while (rlc == 'r' || rlc == 'l' || rlc == 'c'); //happens if any above is desired
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...
The content of course::getEnrollYN() is wrong.

Remember that a = 0 assigns a value to the variable a and a == 0 compares a with 0.

This:
1
2
3
4
5
		else if (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;
			}
		}
		else if (rlc == 'l') //to leave a student
		{
			studCourse.enrollYN = 0; // Note
			cout << "The student is no longer enrolled.";
		}
Topic archived. No new replies allowed.
Pages: 12