0

Does cin>>string if(string==yes){cout<<"something";} work?

I can't get it to work somehow.Is there any other way to make it work.I wanna make it to output something other than integer when i type yes.I'm new to coding! https://code.sololearn.com/cQN27hChsfbL/#cpp

11th Dec 2017, 11:24 AM
Justin Yu
Justin Yu - avatar
2 Answers
+ 3
Your are checking against a string, that means you have to do if (string == "yes"). The double quotation marks are necessary to tell the compiler you are checking against a string. Then it should work fine.
11th Dec 2017, 11:30 AM
Shadow
Shadow - avatar