Modification architecture projet
Il faut maintenant utiliser le make.sh pour compiler le turbo_main avec le jour voulu.
This commit is contained in:
parent
7881f8b97a
commit
bfede03757
2 changed files with 45 additions and 0 deletions
20
make.sh
Executable file
20
make.sh
Executable file
|
@ -0,0 +1,20 @@
|
|||
#!/bin/bash
|
||||
|
||||
jour=0
|
||||
while [ $jour -le 0 ] || [ $jour -ge 25 ]
|
||||
do
|
||||
read -p "Indiquez le jour à compiler : " jour
|
||||
if ! [[ $jour =~ ^[0-9]+$ ]]
|
||||
then
|
||||
jour=0
|
||||
fi
|
||||
done
|
||||
|
||||
rm -f *.o turbo_main
|
||||
echo "Compilation de turbo_main.c."
|
||||
gcc -Wall -g turbo_main.c -o turbo_main.o -c
|
||||
echo "Compilation du jour $jour."
|
||||
gcc -Wall -g jour$jour/main.c -o tmp.o -c
|
||||
gcc -o turbo_main tmp.o turbo_main.o
|
||||
rm -f *.o
|
||||
cp jour$jour/input input
|
25
turbo_main.c
Normal file
25
turbo_main.c
Normal file
|
@ -0,0 +1,25 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#define FILENAME "input"
|
||||
|
||||
void premPartie(FILE *ptr);
|
||||
void deuxPartie(FILE *ptr);
|
||||
|
||||
int main()
|
||||
{
|
||||
FILE *ptr = fopen(FILENAME, "r");
|
||||
if (ptr == NULL)
|
||||
{
|
||||
printf("Le fichier %s n’existe pas.\n", FILENAME);
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf("Traitement de la première partie…\n");
|
||||
premPartie(ptr);
|
||||
fseek(ptr, 0, SEEK_SET);
|
||||
printf("\nTraitement de la deuxième partie…\n");
|
||||
deuxPartie(ptr);
|
||||
|
||||
fclose(ptr);
|
||||
return 0;
|
||||
}
|
Loading…
Reference in a new issue