So here's my code:
b:
cout << "\nDo you want to continue (Y/N)? ";
cin >> ans;
if (ans == 'y' || ans == 'Y')
goto a;
else if (ans == 'n' || ans == 'N')
goto c;
else
cout << "Invalid Answer!";
goto b;
my problem is if I enter 2 or more letters, it reads all and throws "invalid answer!" and prints "do you want to continue (y/n)" as many as the letters i've input. like this one
Do you want to continue (Y/N)? asd
Invalid Answer!
Do you want to continue (Y/N)? Invalid Answer!
Do you want to continue (Y/N)? Invalid Answer!
Do you want to continue (Y/N)?