hi.. i would like to compare a user-input string with another string to see if they matched so what should i do?
sample code:
getline(cin,string);
if((i==25)&&([I]string comparsion here[/I]))
do this;
else
if((i==25)&&([I]similar string comparison[/I]))
do something else;
so what should i do? i tried
const char* str = string.c_str();
if((i==25)&&(strcmp(str,"string")))
do this;
else
if((i==12)&&(strcmp(str,"strings")))
do something else;
but it manages to fufil the first if-condition but couldn't fufil the second if-condition.. thanks