Rien n'a avancé :_).

master
Yann CHAMPEAU 3 years ago
parent ad3aaa3147
commit 9ea8c27836

@ -1,4 +1,5 @@
PHONY : clean doc all
.PHONY: clean doc all
all : prog EXE
prog :

BIN
SAE

Binary file not shown.

@ -1,13 +1,13 @@
all : saeMain.o lib
.PHONY : all doc clean lib
.PHONY : all doc clean
all : saeMain.o lib
lib : annexe/saeAnnexe.o partie1/saeP1.o partie2/saeP2.o partie3/saeP3.o partie4/saeP4.o
make -C annexe all
make -C partie1 all
make -C partie2 all
make -C partie3 all
make -C partie4 all
lib :
make -C annexe
make -C partie1
make -C partie2
make -C partie3
make -C partie4
saeMain.o : saeMain.c
gcc -Wall -c saeMain.c

@ -1,3 +1,7 @@
CC = gcc
CCOPTS = -Wall
all : saeAnnexe.o
saeAnnexe.o : saeAnnexe.c saeAnnexe.h

@ -59,14 +59,17 @@ int loadIUT(VilleIUT** tiut){
return tlogi;
}
int rechercheTabPtVilleIUT(VilleIUT* tab[],int lTab,char* mot){
int rechercheIUT(VilleIUT* tab[],int lTab,char mot[]){
printf("CPT1\n");
/*
if(!lTab){
fprintf(stderr,"Erreur, Pas d'éléments dans le tableau !");
fprintf(stderr,"Erreur, Pas de villes enregistrées !\n");
return -1;
}
for(int i=0; i<lTab;i++){
if(tab[i]->Ville==mot) return i;
}
*/
return -1;
}

@ -31,7 +31,7 @@ void menu(void); //
//
int loadIUT(VilleIUT** tiut); //Fichier Binaire. //
//
int rechercheTabPtVilleIUT(VilleIUT* tab[],int lTab,char* mot); //
int rechercheIUT(VilleIUT* tab[],int lTab,char mot[]); //
//
//
//
@ -70,4 +70,4 @@ void vider_file(File f); // //
//
//
void reset(void); //
//--------------------------------------------------------------//
//--------------------------------------------------------------//

@ -106,59 +106,64 @@ void SearchIUTFromDep(VilleIUT* lvIUT[],int tlogi)
//Partie Administrateur.
void menuAdmin(VilleIUT* tiut[],int tlogi){
int quit=0;
while(!quit){
printf("#--------------------------------------------------------------------#\n");
printf("| |\n");
printf("| SAE S1.02 |\n");
printf("| |\n");
printf("#--------------------------------------------------------------------#\n\n");
printf("Codes correspondant aux différentes actions :\n\n");
printf("1 : Modifier le nombre de places dans un département.\n");
printf("2 : Créer un département dans un IUT.\n");
printf("3 : Supprimer un département dun IUT.\n");
printf("4 : Lancer et arrêter la phase de candidature.\n");
printf("5 : Modifier le nom d'un responsable de département.\n");
printf("9 : Revenir à l'écran de sélection du profil.\n\n");
printf("#--------------------------------------------------------------------#\n\n");
printf("Choisissez l'action que vous voulez exécuter : ");
int act;
scanf("%d",&act);
switch(act){
case 1:
modifPlaces(tiut,tlogi);
reset();
break;
case 2:
creerDep(tiut,tlogi);
reset();
break;
case 3:
supprimerDep(tiut,tlogi);
reset();
break;
case 4:
//gestionPhaseCandidatures(); A Faire (Partie 2).
reset();
break;
case 5:
modifNomResponsable(tiut,tlogi);
reset();
break;
case 9:
quit=1;
reset();
}
}
void menuAdmin(VilleIUT* tiut[],int *tlogi){
int quit=0;
while(!quit){
printf("#--------------------------------------------------------------------#\n");
printf("| |\n");
printf("| SAE S1.02 |\n");
printf("| |\n");
printf("#--------------------------------------------------------------------#\n\n");
printf("Codes correspondant aux différentes actions :\n\n");
printf("1 : Modifier le nombre de places dans un département.\n");
printf("2 : Créer un département dans un IUT.\n");
printf("3 : Supprimer un département dun IUT.\n");
printf("4 : Lancer et arrêter la phase de candidature.\n");
printf("5 : Modifier le nom d'un responsable de département.\n");
printf("6 : Créer un IUT.\n");
printf("9 : Revenir à l'écran de sélection du profil.\n\n");
printf("#--------------------------------------------------------------------#\n\n");
printf("Choisissez l'action que vous voulez exécuter : ");
int act;
scanf("%d",&act);
switch(act){
case 1:
modifPlaces(tiut,*tlogi);
reset();
break;
case 2:
creerDep(tiut,*tlogi);
reset();
break;
case 3:
supprimerDep(tiut,*tlogi);
reset();
break;
case 4:
//gestionPhaseCandidatures(); A Faire (Partie 2).
reset();
break;
case 5:
modifNomResponsable(tiut,*tlogi);
reset();
break;
case 6:
creerIUT(tiut,tlogi);
reset();
break;
case 9:
quit=1;
reset();
}
}
}
void modifPlaces(VilleIUT* tiut[],int tlogi){
printf("\nEntrez la ville correspondant à l'IUT à modifier (Q pour abandonner):");
printf("\nEntrez la ville correspondant à l'IUT à modifier (Q pour abandonner): ");
char ville[31];
scanf("%*c%s",&ville);
scanf("%*c%s",ville);
if(ville[0]=='Q' && ville[1]=='\0') return;
int noVille=rechercheTabPtVilleIUT(tiut,tlogi,ville);
int noVille=rechercheIUT(tiut,tlogi,ville);
if(noVille<=0){
fprintf(stderr,"\nVille non existante !\n");
return;
@ -166,7 +171,7 @@ void modifPlaces(VilleIUT* tiut[],int tlogi){
VilleIUT* v=tiut[noVille];
printf("\n\nEntrez le département à modifier:");
char dep[31];
scanf("%*c%s",&dep);
scanf("%*c%s",dep);
if(!existeDep(v->ldept,dep)){
fprintf(stderr,"\nDépartement non existant !\n");
return;
@ -182,11 +187,11 @@ void modifPlaces(VilleIUT* tiut[],int tlogi){
}
void creerDep(VilleIUT* tiut[],int tlogi){
printf("\nEntrez la ville correspondant à l'IUT à modifier (Q pour abandonner):");
printf("\nEntrez la ville correspondant à l'IUT à modifier (Q pour abandonner): ");
char ville[31];
scanf("%*c%s",&ville);
scanf("%*c%s",ville);
if(ville[0]=='Q' && ville[1]=='\0') return;
int noVille=rechercheTabPtVilleIUT(tiut,tlogi,ville);
int noVille=rechercheIUT(tiut,tlogi,ville);
if(noVille<=0){
fprintf(stderr,"\nVille non existante !\n");
return;
@ -202,24 +207,24 @@ void creerDep(VilleIUT* tiut[],int tlogi){
m=m->suivant;
printf("\n\nEntrez le nom du département à créer :");
char dep[31];
scanf("%*c%s",&dep);
scanf("%*c%s",dep);
strcpy(m->departement,dep);
printf("\n\nEntrez le nombre de places disponibles dans le département :");
scanf("%d",&m->nbp);
printf("\n\nEntrez le nom du responsable de département :");
char resp[51];
scanf("%*c%s",&resp);
scanf("%*c%s",resp);
strcpy(m->resp,resp);
printf("\n\nLe département %s a bien été ajouté à l'IUT de %s.\n",dep,ville);
return;
}
void supprimerDep(VilleIUT* tiut[],int tlogi){
printf("\nEntrez la ville correspondant à l'IUT à modifier (Q pour abandonner):");
printf("\nEntrez la ville correspondant à l'IUT à modifier (Q pour abandonner): ");
char ville[31];
scanf("%*c%s",&ville);
scanf("%*c%s",ville);
if(ville[0]=='Q' && ville[1]=='\0') return;
int noVille=rechercheTabPtVilleIUT(tiut,tlogi,ville);
int noVille=rechercheIUT(tiut,tlogi,ville);
if(noVille<=0){
fprintf(stderr,"\nVille non existante !\n");
return;
@ -227,7 +232,7 @@ void supprimerDep(VilleIUT* tiut[],int tlogi){
VilleIUT* v=tiut[noVille];
printf("\n\nEntrez le département à supprimer:");
char dep[31];
scanf("%*c%s",&dep);
scanf("%*c%s",dep);
if(!existeDep(v->ldept,dep)){
fprintf(stderr,"\nDépartement non existant !\n");
return;
@ -236,6 +241,7 @@ void supprimerDep(VilleIUT* tiut[],int tlogi){
if(m->departement==dep){
printf("\n\nVoulez-vous supprimer le département %s de la ville de %s ? (Y pour continuer)\n\n",m->departement,v->Ville);
char choix;
scanf("%*c%c",&choix);
if(choix!='Y') return;
v->ldept=m->suivant;
free(m);
@ -244,6 +250,7 @@ void supprimerDep(VilleIUT* tiut[],int tlogi){
while(m->suivant->departement!=dep) m=m->suivant;
printf("\n\nVoulez-vous supprimer le département %s de la ville de %s ? (Y pour continuer)\n\n",m->suivant->departement,v->Ville);
char choix;
scanf("%*c%c",&choix);
if(choix!='Y') return;
MaillonDep* temp;
temp=m->suivant;
@ -255,11 +262,11 @@ void supprimerDep(VilleIUT* tiut[],int tlogi){
}
void modifNomResponsable(VilleIUT* tiut[],int tlogi){
printf("\nEntrez la ville correspondant à l'IUT à modifier (Q pour abandonner):");
printf("\nEntrez la ville correspondant à l'IUT à modifier (Q pour abandonner): ");
char ville[31];
scanf("%*c%s",&ville);
scanf("%*c%s",ville);
if(ville[0]=='Q' && ville[1]=='\0') return;
int noVille=rechercheTabPtVilleIUT(tiut,tlogi,ville);
int noVille=rechercheIUT(tiut,tlogi,ville);
if(noVille<=0){
fprintf(stderr,"\nVille non existante !\n");
return;
@ -267,7 +274,7 @@ void modifNomResponsable(VilleIUT* tiut[],int tlogi){
VilleIUT* v=tiut[noVille];
printf("\n\nEntrez le département à modifier:");
char dep[31];
scanf("%*c%s",&dep);
scanf("%*c%s",dep);
if(!existeDep(v->ldept,dep)){
fprintf(stderr,"\nDépartement non existant !\n");
return;
@ -276,8 +283,33 @@ void modifNomResponsable(VilleIUT* tiut[],int tlogi){
while(m->departement!=dep) m=m->suivant;
printf("\n\nLe responsable du département %s de l'IUT de la ville de %s est actuellement %s. Quel est le nom du nouveau responsable ?\n\n",m->departement,v->Ville,m->resp);
char nom[51];
scanf("%d",&nom);
scanf("%s",nom);
strcpy(m->resp,nom);
printf("\n\nLe nom du responsable du département %s de l'IUT de %s a bien été changé pour %s.\n",dep,ville,nom);
return;
}
void creerIUT(VilleIUT* tiut[],int* tlogi){
printf("\nEntrez le nom de la ville correspondant à l'IUT à ajouter (Q pour abandonner): ");
char ville[31];
scanf("%*c%s",ville);
if(ville[0]=='Q' && ville[1]=='\0') return;
fprintf(stderr,"before !\n");
int noVille=rechercheIUT(tiut,*tlogi,ville);
fprintf(stderr,"end !\n");
if(noVille>0){
fprintf(stderr,"\nVille déjà existante !\n");
return;
}
VilleIUT* v=(VilleIUT*)malloc(sizeof(VilleIUT));
if(v==NULL){
perror("malloc");
exit(errno);
}
strcpy(v->Ville,ville);
v->ldept=NULL;
tiut[*tlogi]=v;
*tlogi=*tlogi+1;
printf("\n\nL'IUT de %s a bien été ajouté.\n",ville);
return;
}

@ -28,7 +28,7 @@ void SearchIUTFromDep(VilleIUT* lvIUT[],int tlogi);
//Admin
void menuAdmin(VilleIUT* tiut[],int tlogi);
void menuAdmin(VilleIUT* tiut[],int* tlogi);
void modifPlaces(VilleIUT* tiut[],int tlogi);
@ -36,4 +36,6 @@ void creerDep(VilleIUT* tiut[],int tlogi);
void supprimerDep(VilleIUT* tiut[],int tlogi);
void modifNomResponsable(VilleIUT* tiut[],int tlogi);
void modifNomResponsable(VilleIUT* tiut[],int tlogi);
void creerIUT(VilleIUT* tiut[],int* tlogi);

@ -24,7 +24,7 @@ int main(void)
break;
case 'A':
reset();
menuAdmin(tiut,tlogi);
menuAdmin(tiut,&tlogi);
reset();
break;
case 'Q':

Loading…
Cancel
Save