Saturday, 24 August 2013

Timer not running, Cannot see why not - C++

Timer not running, Cannot see why not - C++

I am trying to make a count down timer, for some reason it seems to not be
executing the (Hour >= 1) while statement properly -- if i comment out
--Hour and the Minute = Minute +60 the program runs fine counting down
from 60 and then decrementing a minute and re starting at 60 seconds each
time ... can someone explain to me why the hour decrement doesnt want to
work ?? im new to c++ and programming in general so if you could keep it
as simple as is possible thanks. Code snippet below:
while (Hour >= 1)
{
while (Minute >= 1)
{
while (Second >= 1)
{
Sleep(1000);
--Second;
cout << Hour << " hours, " << Minute << " minutes, " << Second
<< " seconds;\n";
}
Second = Second + 60;
--Minute;
}
Minute = Minute + 60;
--Hour;
}

No comments:

Post a Comment