I've been working on a quiz for my semestral work. It's a simple one since I'm a beginner. And I wanted to let the user insert the character of the option but it's not stopping after the character is inserted and I don't know how to solve it.
int giveAnswera (string answer)
{
int x = 0;
cout << "Enter the answer in form of a, b or c." << endl;
cin >> answer;
if (cin >> answer == "a")
{
cout << "✓" << endl;
cout << "Well done." << endl;
x = x+2;
}
else
{
cout << "×" << endl;
cout << "You're wrong. You get no points." << endl;
x = x+0;
}
return x;
}