The error is occurring because you are trying to compare a single character (char) to a string ("red") in this line: if (signal == "red") To fix this, you should compare signal to a character instead of a string. For example: if (signal == 'r') { cout << "don't go! Plz stop!" << endl; } Alternatively, if you want to compare signal to a string, you should declare signal as a string type instead of a char type. Here's an example: string signal; cout << "enter signal name:" << endl; cin >> signal; if (signal == "red") { cout << "don't go! Plz stop!" << endl; } cout << "once the signal is green then you can go:)" << endl; This way, you can compare signal to strings without any conversion errors.