Dec 18, 2009 at 1:53pm UTC
Whenever i try to use a string variable with an if statement it turns up as error. Does anybody know why?
Here is the part of my code where the error is:
string mystr3;
getline (cin, mystr3);
string mystr2 (mystr3);
int myint;
stringstream(mystr2) >> myint;
cout << mystr3 << endl;
if (mystr3 == 'blaa')
cout << "yay" << endl;
Last edited on Dec 18, 2009 at 1:53pm UTC
Dec 18, 2009 at 1:59pm UTC
try inverted commas ( "" )
single commas are for use with chars.
I got the same error, and changed to inverted... but then a new stringstream error popped up after that as I'm unsure of the correct declaration of it.
Last edited on Dec 18, 2009 at 2:00pm UTC
Dec 18, 2009 at 4:51pm UTC
Hmm.. it still doesn't work... I guess ill just have to convert words to number codes...