Mercurial Hosting > repper
comparison repper.c @ 0:0e9d15783f1d
Finished program
author | VilyaemKenyaz |
---|---|
date | Fri, 25 Aug 2023 13:46:12 -0400 |
parents | |
children | deb42211d649 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:0e9d15783f1d |
---|---|
1 // Repper helps the user pace their reps and sets | |
2 | |
3 #include <stdio.h> | |
4 #include <stdlib.h> | |
5 #include <unistd.h> | |
6 | |
7 int main(int argc, char* argv[]){ | |
8 | |
9 if (argc == 1){ | |
10 puts("Repper by Vilyaem peepsoftgames.github.io thekenyaz@yandex.com\n Usage: \n repper (unsigned int sets) (unsigned int reps) (unsigned int reptime) (unsignd int settime)\n 3 Beeps is a set completion, 1 beep is rep completion, this uses the 'beep' program. \n"); | |
11 exit(1); | |
12 } | |
13 | |
14 unsigned int sets = atoi(argv[1]); | |
15 unsigned int reps = atoi(argv[2]); | |
16 unsigned int reptime = atoi(argv[3]); | |
17 unsigned int settime = atoi(argv[4]); | |
18 printf("Starting repper with %d Sets and %d Reps Rep Rest: %d Set Rest: %d \n", sets, reps, reptime, settime); | |
19 printf("Waiting 3 Seconds to make sure you are ready\n"); | |
20 sleep(3); | |
21 for ( sets > 0; sets--;){ | |
22 | |
23 for (unsigned int newreps = reps; newreps > 0; newreps --){ | |
24 sleep(reptime); | |
25 system("beep"); | |
26 printf("Rep completed, reps left in the set: %d\n", newreps); | |
27 } | |
28 system("beep;beep;beep"); | |
29 printf("Set completed, sets left in the exercise: %d\n", sets); | |
30 sleep(settime); | |
31 } | |
32 | |
33 printf("Repper is finished\n"); | |
34 exit(0); | |
35 } |