Git s'il te plait

master
Jade VAN BRABANDT 3 years ago
commit 75aecbeed7

4
.gitignore vendored

@ -36,6 +36,7 @@
*.i*86 *.i*86
*.x86_64 *.x86_64
*.hex *.hex
SAE
# Debug files # Debug files
*.dSYM/ *.dSYM/
@ -59,7 +60,8 @@ dkms.conf
.LSOverride .LSOverride
# Icon must end with two \r # Icon must end with two \r
Icon Icon
# Thumbnails # Thumbnails
._* ._*

BIN
SAE

Binary file not shown.

@ -60,16 +60,13 @@ int loadIUT(VilleIUT** tiut){
} }
int rechercheIUT(VilleIUT* tab[],int lTab,char mot[]){ int rechercheIUT(VilleIUT* tab[],int lTab,char mot[]){
printf("CPT1\n");
/*
if(!lTab){ if(!lTab){
fprintf(stderr,"Erreur, Pas de villes enregistrées !\n"); fprintf(stderr,"Erreur, Pas de villes enregistrées !\n");
return -1; return -1;
} }
for(int i=0; i<lTab;i++){ for(int i=0; i<lTab;i++){
if(tab[i]->Ville==mot) return i; if(!strcmp(tab[i]->Ville,mot)) return i;
} }
*/
return -1; return -1;
} }

@ -12,7 +12,7 @@ void menuUser(VilleIUT* lvIUT[],int tlogi)
{ {
int quit=0; int quit=0;
while(!quit) while(!quit)
{ {
printf("#--------------------------------------------------------------------#\n"); printf("#--------------------------------------------------------------------#\n");
printf("| |\n"); printf("| |\n");
printf("| SAE S1.02 |\n"); printf("| SAE S1.02 |\n");
@ -25,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){
@ -46,7 +47,7 @@ void menuUser(VilleIUT* lvIUT[],int tlogi)
break; break;
case 9: case 9:
quit=1; quit=1;
break; reset();
} }
} }
@ -54,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) while (MaillonAct!=NULL)
{ {
@ -215,30 +216,38 @@ 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];
MaillonDep* m=v->ldept; int ck=0;
while(m->suivant!=NULL) m=m->suivant; if(v->ldept==NULL){
m->suivant=(MaillonDep*)malloc(sizeof(MaillonDep)); ck=1;
if(m->suivant==NULL){ v->ldept=(MaillonDep*)malloc(sizeof(MaillonDep));
perror("malloc"); if(v->ldept==NULL){
exit(errno); perror("malloc");
exit(errno);
}
} }
m=m->suivant; MaillonDep* m=v->ldept;
printf("\n\nEntrez le nom du département à créer :"); if(!ck){
char dep[31]; while(m->suivant!=NULL) m=m->suivant;
scanf("%*c%s",dep); m->suivant=(MaillonDep*)malloc(sizeof(MaillonDep));
strcpy(m->departement,dep); if(m->suivant==NULL){
printf("\n\nEntrez le nombre de places disponibles dans le département :"); perror("malloc");
exit(errno);
}
m=m->suivant;
}
printf("\n\nEntrez le nom du département à créer : ");
scanf("%*c%s",m->departement);
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;
} }
@ -317,9 +326,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;

@ -138,5 +138,5 @@ void ListeCandidat(int nbcandidat,candidat *tcandidat)
printf("Candidat non trouvé"); printf("Candidat non trouvé");
} }
//void gestionPhaseCandidatures(); A FAIRE.*/ //void gestionPhaseCandidatures(); A FAIRE.

@ -20,12 +20,10 @@ int main(void)
case 'C': case 'C':
reset(); reset();
menuUser(tiut,tlogi); menuUser(tiut,tlogi);
reset();
break; break;
case 'A': case 'A':
reset(); reset();
menuAdmin(tiut,&tlogi); menuAdmin(tiut,&tlogi);
reset();
break; break;
case 'Q': case 'Q':
printf("Êtes-vous sûr de vouloir quitter ? (Y pour continuer)\n\n"); printf("Êtes-vous sûr de vouloir quitter ? (Y pour continuer)\n\n");

Loading…
Cancel
Save