I am working on an assignment, so far I am asking the user whether they want to go first or not. I am wanting to check their input to make sure it matches the two values that I want.
I am getting errors about conversion while using Visual Studio such as:
'==': no conversion from 'int' to 'std::string'
no operator "==" matches these operands
Any support is greatly appreciated.
Your problem is in the line:
if (turnChoice == 'yes' || turnChoice == 'no')
C++ and C denote single characters with the single quotation marks, not strings of characters. The compiler is thus attempting to convert your single quotation marks into an integer value. You must use double quotations for string literals. So change the above line to:
if (turnChoice == "yes" || turnChoice == "no")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With