First off, I want to say that I know this issue has come up before on StackOverflow. However, I am still having an issue with my code.
Roster* classRoster = new Roster(numStudents);
cout << "Parsing data and adding students" << endl;
for (int i = 0; i < numStudents; i++){
classRoster->parseAdd(allStudentData[i]);
}
cout << "All done.\n";
cout << "Displaying all student information:\n";
classRoster->printAll();
cout << "Removing A3:\n";
if (classRoster->remove("A3")) classRoster->printAll();
else cout << "Student ID not found!\n";
In this code, the classRoster
in if (classRoster->remove("A3"))
gets an error saying that the "expression must have a bool type (or be convertible to bool)" and I honestly have no idea why. The classRoster
above is working perfectly fine in the lines above the problematic code.
My remove()
function is a void remove(string)
function that accepts strings, so I don't believe it's the "A3" causing it issues.
Does anyone have an idea as to why this would be happening?