Wolf
Wolf

Reputation: 321

Creating a countdown but displaying (x-1):00 bug

I've created a timer, which allows to input a seconds and minutes, then begins the countdown, when for example as user inputs 2:01 it becomes 1:00 (instead of 2:00) then 1:59, effectively displaying (x-1):00 of the timer. I know the code doesn't seem very nice to look at and has a bunch of if statements to display a leading zero because integer doesn't like having it.

Upvotes: 0

Views: 59

Answers (1)

Remi878
Remi878

Reputation: 341

I don't see where minutesNum variable comes form. But I would sugess you to only use one int counter variable (very simple to handle) with a display function to display minutes and secondes from that variable.

Upvotes: 1

Related Questions