How to evaluate or compare strings
Hello. I've just started learning C++ so I apologise in advance if my question is simple and/or dumb. I'd like to write a program that will execute a statement if a certain condition (determined by a character variable) is met. To make this easier to understand, I've added the code bellow: #include <iostream> #include <string> //I've tried with and without this chunk to no avail using namespace std; int main() { string trigger = "Pink flamingo"; string usrName; cout << "Greetings. Please input your name:" << endl; cin >> usrName; //user inputs their name //the idea is that this conditional is executed when usrName is the same as trigger if (usrName == trigger){ cout << "I'm sorry but I do believe that is a lie. \n" << endl; } cout << "Thanks " << usrName << "!" << endl; return 0; } One thing I've noticed is that if I change the program so that it behaves the same way but using Pink instead of Pink flamingo, it will work. Could someone please explain to me why this isn't working or what needs to be changed to make it work? Many thanks