-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
34 lines (29 loc) · 802 Bytes
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main() {
int ex;
char exercise[12];
char command[128];
while (1) {
printf("What exercise would you like to visualise ?\n");
scanf("%d",&ex);
if (ex == 0) {
break;
}
if (ex < 10) {
sprintf(exercise, "Exercice_0%d", ex);
} else {
sprintf(exercise, "Exercice_%d", ex);
} // find the correct file name
sprintf(command, "gcc %s.c -o Execs/%s\n", exercise, exercise);
system(command);
for (int i = 0; i < 128; i++) {
command[i] = '\0';
}
sprintf(command, "Execs\\%s\n", exercise); // add ./ if not using config
system(command);
printf("\n");
}
return 0;
}