Reaction game

So i have been making a game that uses a reaction tester. It tells the player to get ready then after 4 - 6 seconds it prints the word go and you have to press enter as fast as possible. If you hit within a certain amount of time you win. The problem is if you press enter before the go appears then when the 4 - 6 seconds are done it says you took 1 millisecond and you won. Any ideas?

cout << "You prepare to attack!" << endl;
waittime = rand() % 6000 + 4000;
Sleep(waittime);
start = clock();
cout << "Go!" << endl;
cin.ignore();
reactattck = clock() - start;
cout << reactattck << endl;
if (reactattck <= difficulty)
{
cout << "You successfully hit " << enemyname << "!" << endl;
enmyhp -= 10;
if (enmyhp <= 0)
{
cout << "You defeated " << enemyname << "!" << endl;
return 0;
}
}
else if (reactattck > difficulty)
{
cout << "You missed!" << endl;
}
Topic archived. No new replies allowed.