|
I should have told my problem more indepth, I needed a way for the game to keep running while the user is inputting his command. I finally though of a way though, I'm going to set a timer of some small amount, where if the user doesnt input when the timer runs out, the computer will just put in a NULL response and continue on. My problem now is how to set a timer.
Anyways this is the program that my friend sent me.
/////////////////////////////////////////////////////////////////////////////////
#include <conio.h>
#include <iostream>
using std::cout;
using std::endl;
int main()
{
char tmp;
system("cls");
cout << "Hit a key, please ('q' to quit)." << endl;
do
{
while(!_kbhit());
tmp = _getch();
cout << tmp;
} while (tmp != 'q');
cout << endl << endl;
system("pause");
return 0;
}
/////////////////////////////////////////////////////////////////////////////////
|