diff options
-rw-r--r-- | timer.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -1,11 +1,10 @@ #include <stdio.h> #include <unistd.h> -int main(){ +int main(int argc, char** argv){ int min; int sec; - printf("Input #minutes:#seconds "); - scanf("%d:%d", &min, &sec); - printf("\n"); + if (argc != 2) return 1; + sscanf(argv[1], "%d:%d", &min, &sec); int time = min*60 + sec; for (int i = 1; i<=time; i++){ printf("%d:%02d/%d:%02d\r", (i-i%60)/60, i%60, min, sec); |