Hello again!
Right now I am trying to compare user input with a prepared string. It is not recognizing though.
I have tried these variants:
Code:
getline(cin, input); //input is the string that contains the user input
std::string str2 = "something"; //assume that the user inputs something
if(input==str2)
//does not run
Code:
getline(cin, input); //input is the string that contains the user input
std::string str2 = "something"; //assume that the user inputs something
if(input.compare(str2)==0)
//does not run
Code:
getline(cin, input); //input is the string that contains the user input
//assume that the user inputs something
if(input=="something")
//does not run
Code:
getline(cin, input); //input is the string that contains the user input
//assume that the user inputs something
if(input==(string)"something")
//does not run
Code:
getline(cin, input); //input is the string that contains the user input
//assume that the user inputs something
if(input.compare((string)"something")==0)
//does not run
I do not see how else can this be done.