I have not been able to find my book...what is the command for key presses again? Like if I press something a action happens
Printable View
I have not been able to find my book...what is the command for key presses again? Like if I press something a action happens
"getch()"?
I think that's in "conio.h"
Brendan
Example:
BrendanCode:int main()
{
int keyPress;
cout << "Enter a number between 1 and 3: ";
keyPress = getch();
switch (keyPress)
{
case '1':
cout << "You entered one!\n";
break;
case '2':
cout << "You entered two!\n";
break;
case '3':
cout << "You entered three!\n";
break;
default:
cout << "Not a number between 1 and 3!\n";
break;
}
return 0;
}
Is there a certain resource file for that command harry? Cause it won't work with just i/o stream...Anyone?!? :confused:
"conio.h"
Brendan