c++if-statementstatements

How do you use Yes/No to input your answer C++?


I have my program here.

#include <iostream>
#include <string>
using namespace std;
int main()
{
string input;
cout << "say yes or no" << endl;
cin >> input;
if(input == Yes)
{
    cout << "test" << endl;
}
else if(input == No)
{
    cout << "test123" << endl;
}
system("pause");
}

It says that Yes and No are undefined? Please help I am new to c++


Solution

  • You should use doubleQuotes for string "Yes" "No"