-
Test for Key press
Im a complete newbie at C++
I have created an object using a constructor. When an object is created a message is displayed on screen. I want to be able to display this message on the screen until a user presses a key before the program returns to main.
In the main i have
void main()
{
object new_object("Display This");
object2 new_object2;
new_object2.afunction();
}
The constructor code is
object::object(char adsupplied[])
{
while(??)
{
cout << text<<endl;
}
}
I know a need a while loop in the constructor but do not now how to detect if a key is pressed.
Any help would be appreciated
-
-=conio.h=-
kbhit() - check if a keystroke is avaliable
getch() - get the keypress
-=bios.h=-
bioskey(3) - Check if modifiers were pressed (Shift, Alt ....)
bioskey(1) - bios version of kbhit()
bioskey(0) - bios version of getch()