bool stop = false;
int hours = 0;
int minutes = 0;
int seconds = 0;
while (stop == false)
{
system("cls");
cout << "Hours Minutes Seconds\n";
cout << hours << " " << minutes << " " << seconds << endl;
Sleep(1000);
seconds++;
if (seconds == 60)
{
minutes++;
if (minutes == 60)
{
hours++;
minutes = 0;
}
seconds = 0;
}
}
I want to exit the while loop somehow but the only way I can think of would be to ask for user input, but I can't do this because it would mess up the stopwatch.
Aucun commentaire:
Enregistrer un commentaire