Does anyone know how to get the input of a user without them haveing to press enter after they are finished..
for example:
1. Go home
2. Get Drunk
3. Get layed
>>3
and then immidiatly after the user presses 1,2 or 3 it goes to that option
Does anyone know how to get the input of a user without them haveing to press enter after they are finished..
for example:
1. Go home
2. Get Drunk
3. Get layed
>>3
and then immidiatly after the user presses 1,2 or 3 it goes to that option
int choice;
cin >> choice;
switch (choice)
{
case 1:
cout << "you went home";
case 2:
cout << "you got drunk";
case 3:
cout << "you got laid";
default:
cout << "invalid choice";
}
that wouldn't work you would still have to press enter after the user type's a number to put it into choise.
Dev C++
Win XP/2k/98
I DO NOT TAKE CLASSES I DONT GET HOMEWORK THIS IS NOT A HOMEWORK QUESTION!!!
He's lean he's keen... He's the spank machine!
char option = getch();
if (option =='1')
{
cout<<"you got drunk with a ferret called pete";
}
if (option == '2')
{
cout<<"you went home with pete the ferret";
}
if (option == '3')
{
cout<<"you and pete the ferret ...";
}
Monday - what a way to spend a seventh of your life
thanx it works
Dev C++
Win XP/2k/98
I DO NOT TAKE CLASSES I DONT GET HOMEWORK THIS IS NOT A HOMEWORK QUESTION!!!
He's lean he's keen... He's the spank machine!