hello!
idk why i am getting an infinity loop when i try to get a char to 'y'
idk just look
int yesorno;
cout<<"Go to see???\n(Y/N)" ;
cin>> yesorno;
if(yesorno != 'y')
{
do {
cout<<"\nYou should really go see it!\n";
cout<<"Go to see the gnome?(Y/N)";
cin>> yesorno;
}
while (yesorno != 'y');
and when it comes to this part it keeps scrolling:
You should really go see it!
Go to see the gnome?(Y/N)
You should really go see it!
Go to see the gnome?(Y/N)
You should really go see it!
Go to see the gnome?(Y/N)
and so on for infinity, and it doesnt let me type in letter y.
heres some of the code im using and where i am encountering the problem:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
system("echo The ship gets on fire and is falling down");
system("echo And so, the ship crashes.");
system("echo As you climb out of the rubble,you hear voice of an old gnome...");
int yesorno;
cout<<"Go to see???\n(Y/N)" ;
cin>> yesorno;
if(yesorno != 'y')
{
do
{
cout<<"\nYou should really go see it!\n";
cout<<"Go to see the gnome?(Y/N)";
cin>> yesorno;
system("pause");
}
while (yesorno != 'y');
}
system("cls");
system("PAUSE");
return EXIT_SUCCESS;
}
|