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 runCode: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 runCode:getline(cin, input); //input is the string that contains the user input //assume that the user inputs something if(input=="something") //does not runCode:getline(cin, input); //input is the string that contains the user input //assume that the user inputs something if(input==(string)"something") //does not runI do not see how else can this be done.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



1Likes
LinkBack URL
About LinkBacks



