#include <iostream>
usingnamespace std;
int main()
{
char Answer;
start:
cout << "Do you want a Dinosaur?(1=Yes/0=No):";
cin >> Answer;
if (Answer == '1')
{
cout << "Sorry, you can't have one.\n";
}
elseif (Answer == '0')
{
cout << "Why not!? Dinosaurs are awesome!\n";
goto start;
}
else
{
cout << "That's not an answer, try again.\n";
goto start;
}
system("pause");
}
The issue comes when you type more than 1 character, if you type for expample 15 It first reads the 1 and forgets about the 5, but if you type 23, it automatically runs the program again with the answer being 2 and then 3. How can i make the program to only read the first number, and only the first number?