|
|
@ -13,7 +13,6 @@ void menuUser(VilleIUT* lvIUT[],int tlogi)
|
|
|
|
int quit=0;
|
|
|
|
int quit=0;
|
|
|
|
while(!quit)
|
|
|
|
while(!quit)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int intUserEntry=0;
|
|
|
|
|
|
|
|
printf("#--------------------------------------------------------------------#\n");
|
|
|
|
printf("#--------------------------------------------------------------------#\n");
|
|
|
|
printf("| |\n");
|
|
|
|
printf("| |\n");
|
|
|
|
printf("| SAE S1.02 |\n");
|
|
|
|
printf("| SAE S1.02 |\n");
|
|
|
@ -26,6 +25,7 @@ void menuUser(VilleIUT* lvIUT[],int tlogi)
|
|
|
|
printf("4 : Rechercher les IUTs possèdant un département précis.\n");
|
|
|
|
printf("4 : Rechercher les IUTs possèdant un département précis.\n");
|
|
|
|
printf("9 : Revenir à l'écran de sélection du profil.\n\n");
|
|
|
|
printf("9 : Revenir à l'écran de sélection du profil.\n\n");
|
|
|
|
printf("#--------------------------------------------------------------------#\n\n");
|
|
|
|
printf("#--------------------------------------------------------------------#\n\n");
|
|
|
|
|
|
|
|
printf("Choisissez l'action que vous voulez exécuter : ");
|
|
|
|
int act;
|
|
|
|
int act;
|
|
|
|
scanf("%d",&act);
|
|
|
|
scanf("%d",&act);
|
|
|
|
switch(act){
|
|
|
|
switch(act){
|
|
|
@ -47,7 +47,7 @@ void menuUser(VilleIUT* lvIUT[],int tlogi)
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 9:
|
|
|
|
case 9:
|
|
|
|
quit=1;
|
|
|
|
quit=1;
|
|
|
|
break;
|
|
|
|
reset();
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -55,14 +55,14 @@ void menuUser(VilleIUT* lvIUT[],int tlogi)
|
|
|
|
|
|
|
|
|
|
|
|
void SearchCityWithIUT(VilleIUT* lvIUT[], int tlogi)
|
|
|
|
void SearchCityWithIUT(VilleIUT* lvIUT[], int tlogi)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
for (int i=0;i<tlogi;++i) printf("%s",lvIUT[i]->Ville);
|
|
|
|
for (int i=0;i<tlogi;++i) printf("\n - %s",lvIUT[i]->Ville);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DepEachIUT(VilleIUT* lvIUT[], int tlogi)
|
|
|
|
void DepEachIUT(VilleIUT* lvIUT[], int tlogi)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
for (int i=0;i<tlogi;++i)
|
|
|
|
for (int i=0;i<tlogi;++i)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
printf("%s :",lvIUT[i]->Ville);
|
|
|
|
printf("\n - %s :",lvIUT[i]->Ville);
|
|
|
|
MaillonDep* MaillonAct=lvIUT[i]->ldept;
|
|
|
|
MaillonDep* MaillonAct=lvIUT[i]->ldept;
|
|
|
|
while (MaillonAct!=NULL) printf("\t-%s\n",MaillonAct->departement);
|
|
|
|
while (MaillonAct!=NULL) printf("\t-%s\n",MaillonAct->departement);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -209,12 +209,22 @@ void creerDep(VilleIUT* tiut[],int tlogi){
|
|
|
|
scanf("%*c%s",ville);
|
|
|
|
scanf("%*c%s",ville);
|
|
|
|
if(ville[0]=='Q' && ville[1]=='\0') return;
|
|
|
|
if(ville[0]=='Q' && ville[1]=='\0') return;
|
|
|
|
int noVille=rechercheIUT(tiut,tlogi,ville);
|
|
|
|
int noVille=rechercheIUT(tiut,tlogi,ville);
|
|
|
|
if(noVille<=0){
|
|
|
|
if(noVille<0){
|
|
|
|
fprintf(stderr,"\nVille non existante !\n");
|
|
|
|
fprintf(stderr,"\nVille non existante !\n");
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
VilleIUT* v=tiut[noVille];
|
|
|
|
VilleIUT* v=tiut[noVille];
|
|
|
|
|
|
|
|
int ck=0;
|
|
|
|
|
|
|
|
if(v->ldept==NULL){
|
|
|
|
|
|
|
|
ck=1;
|
|
|
|
|
|
|
|
v->ldept=(MaillonDep*)malloc(sizeof(MaillonDep));
|
|
|
|
|
|
|
|
if(v->ldept==NULL){
|
|
|
|
|
|
|
|
perror("malloc");
|
|
|
|
|
|
|
|
exit(errno);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
MaillonDep* m=v->ldept;
|
|
|
|
MaillonDep* m=v->ldept;
|
|
|
|
|
|
|
|
if(!ck){
|
|
|
|
while(m->suivant!=NULL) m=m->suivant;
|
|
|
|
while(m->suivant!=NULL) m=m->suivant;
|
|
|
|
m->suivant=(MaillonDep*)malloc(sizeof(MaillonDep));
|
|
|
|
m->suivant=(MaillonDep*)malloc(sizeof(MaillonDep));
|
|
|
|
if(m->suivant==NULL){
|
|
|
|
if(m->suivant==NULL){
|
|
|
@ -222,17 +232,15 @@ void creerDep(VilleIUT* tiut[],int tlogi){
|
|
|
|
exit(errno);
|
|
|
|
exit(errno);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
m=m->suivant;
|
|
|
|
m=m->suivant;
|
|
|
|
|
|
|
|
}
|
|
|
|
printf("\n\nEntrez le nom du département à créer : ");
|
|
|
|
printf("\n\nEntrez le nom du département à créer : ");
|
|
|
|
char dep[31];
|
|
|
|
scanf("%*c%s",m->departement);
|
|
|
|
scanf("%*c%s",dep);
|
|
|
|
|
|
|
|
strcpy(m->departement,dep);
|
|
|
|
|
|
|
|
printf("\n\nEntrez le nombre de places disponibles dans le département : ");
|
|
|
|
printf("\n\nEntrez le nombre de places disponibles dans le département : ");
|
|
|
|
scanf("%d",&m->nbp);
|
|
|
|
scanf("%d",&m->nbp);
|
|
|
|
printf("\n\nEntrez le nom du responsable de département :");
|
|
|
|
printf("\n\nEntrez le nom du responsable de département : \n");
|
|
|
|
char resp[51];
|
|
|
|
scanf("%*c");
|
|
|
|
scanf("%*c%s",resp);
|
|
|
|
fgets(m->resp, 51, stdin);
|
|
|
|
strcpy(m->resp,resp);
|
|
|
|
printf("\n\nLe département %s a bien été ajouté à l'IUT de %s.\n",m->departement,ville);
|
|
|
|
printf("\n\nLe département %s a bien été ajouté à l'IUT de %s.\n",dep,ville);
|
|
|
|
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -311,9 +319,7 @@ void creerIUT(VilleIUT* tiut[],int* tlogi){
|
|
|
|
char ville[31];
|
|
|
|
char ville[31];
|
|
|
|
scanf("%*c%s",ville);
|
|
|
|
scanf("%*c%s",ville);
|
|
|
|
if(ville[0]=='Q' && ville[1]=='\0') return;
|
|
|
|
if(ville[0]=='Q' && ville[1]=='\0') return;
|
|
|
|
fprintf(stderr,"before !\n");
|
|
|
|
|
|
|
|
int noVille=rechercheIUT(tiut,*tlogi,ville);
|
|
|
|
int noVille=rechercheIUT(tiut,*tlogi,ville);
|
|
|
|
fprintf(stderr,"end !\n");
|
|
|
|
|
|
|
|
if(noVille>0){
|
|
|
|
if(noVille>0){
|
|
|
|
fprintf(stderr,"\nVille déjà existante !\n");
|
|
|
|
fprintf(stderr,"\nVille déjà existante !\n");
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|