Im trying to make a minutes and seconds timer but am having some trouble. The timer does not have to stop, as it will rarely go up to 5 mins.
Im trying to format it as mm:ss.
#include <time.h>
#include <stdio.h>
#include <windows.h>
#define TRUE 1
int main( void ) {
int min = 0;
int sec = 0;
while(TRUE){
printf("%02d : %02d", min, sec);
sec++;
Sleep(1000);
if (sec == 59){
min++;
sec = 0;
}
}
return 0;
}
I've been trying this code but it does not seem to show the timer in the terminal when I run it.