Explain me how to use kbhit function in turbo c++.
1 Like
Also i recommend you to switch to other compiler like DEV C++ or VS…as Turbo c interface is very poor as compared to dev C
…
So Download dev c from this link…trust me…you will enjoy writing the code…
http://sourceforge.net/projects/orwelldevcpp/files/latest/download
3 Likes
This function is not defined as part of the ANSI C/C++ standard. It is generally used by Borland’s family of compilers. It checks if any keystroke is there in the keyboard buffer. If yes, then it returns a non zero integer and the keystroke can be retreived using getch() or getche() else return 0. A short segment of code may help more:
int main()
{
cout<<"Press any key : ";
while(!kbhit())
;
cout<<"You pressed a key :) You may exit now .... \n";
cout<<"THANKYOU :P";
return 0;
}