Im creating a slot machine program and used the kbhit command to stop the reels. Right now im tryn to change how the program works instead of stoping it all at once i want the reels to stop one at a time (everytime a key is pressed one reel would stop)
the problem is i dont know to reset the kbhit command. once you pressed anything on the keyboard itll register that you have pressed somethin and will not reset it anymore.
please help im new to C...
thanks in advance
here's the current code:
itll stop the first number but during the next iteration itll automatically stop the second num then the third
#include<stdio.h>
#include<conio.h>
#include<dos.h>
#include<stdlib.h>
main()
{
int x1,x2,x3,y=0;
randomize();
for( ; ; )
{
clrscr();
if(y==0)
x1=rand()%9;
if(y<=1)
x2=rand()%9;
if(y<=2)
x3=rand()%9;
printf("%d %d %d",x1,x2,x3);
if(kbhit())
y++;
}
getche();
}