comparison repper.c @ 1:deb42211d649

Automated Vimcurial commmit
author VilyaemKenyaz
date Mon, 11 Sep 2023 12:53:43 -0400
parents 0e9d15783f1d
children
comparison
equal deleted inserted replaced
0:0e9d15783f1d 1:deb42211d649
4 #include <stdlib.h> 4 #include <stdlib.h>
5 #include <unistd.h> 5 #include <unistd.h>
6 6
7 int main(int argc, char* argv[]){ 7 int main(int argc, char* argv[]){
8 8
9 if (argc == 1){ 9 if (argc == 1){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.\n");exit(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 10
14 unsigned int sets = atoi(argv[1]); 11 unsigned int sets = atoi(argv[1]);
15 unsigned int reps = atoi(argv[2]); 12 unsigned int reps = atoi(argv[2]);
16 unsigned int reptime = atoi(argv[3]); 13 unsigned int reptime = atoi(argv[3]);
17 unsigned int settime = atoi(argv[4]); 14 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); 15 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"); 16 puts("Waiting 3 Seconds to make sure you are ready\n");
20 sleep(3); 17 sleep(3);
21 for ( sets > 0; sets--;){ 18 for ( sets > 0; sets--;){
22 19
23 for (unsigned int newreps = reps; newreps > 0; newreps --){ 20 for (unsigned int newreps = reps; newreps > 0; newreps --){
24 sleep(reptime); 21 sleep(reptime);
25 system("beep"); 22 putchar('\a');
26 printf("Rep completed, reps left in the set: %d\n", newreps); 23 printf("Rep completed, reps left in the set: %d\n", newreps);
27 } 24 }
28 system("beep;beep;beep"); 25 puts("\a\a\a");
29 printf("Set completed, sets left in the exercise: %d\n", sets); 26 printf("Set completed, sets left in the exercise: %d\n", sets);
30 sleep(settime); 27 sleep(settime);
31 } 28 }
32 29
33 printf("Repper is finished\n"); 30 puts("Repper is finished");
34 exit(0); 31 exit(0);
35 } 32 }