if statement, getting error when declaring a string

So line 20, I have ~~ under all the == signs. Why is this? I would like the program to quit (quit = true;) when the user types one of three different quits. I really can't figure out why I'm getting an error here, as everything else looks correct to me.

My exact error message is:
'bool std::operator ==(const std::error_condition &,const std::error_code &) noexcept'

I have no idea what that means, or what to do with that information.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
 #include <iostream>

using namespace std;



int main()
{

	string name;
	bool quit = false;
	int students = 0;

	cout << "Enter student's name or type STOP to quit." << endl;
	cin >> name;

	while (!quit) {
	

		if (name == 'quit' || name == 'QUIT' || name == 'Quit') {
			cout << "Total registered students: " << students << endl;
			quit = true;
		}
		else {
			students++;
			cout << "Enter the next student's name" << endl;
			cin >> name;
		}
	}

}
"Quit", not 'Quit' (i.e. use double quotes for a string, single quotes for a char). This is C++, not Python.
Last edited on
Thank you very much.

I knew it would be a mistake learning Python first! I should have started out with C++ so I wouldn't be getting confused. Appreciate it.
You are comparing your user input to some variation of "quit", yet you are informing the user to use "STOP" to cease asking for names.
Yes, I saw that too and fixed it when I got the code to run and noticed it wasn't quitting.
My exact error message is:
'bool std::operator ==(const std::error_condition &,const std::error_code &) noexcept'

Um, no. Your exact error message will be considerably longer than that, including a description of what the problem is. Post all the information your compiler is giving you, rather than selected highlights.
Topic archived. No new replies allowed.