diff --git a/.gitignore b/.gitignore index ec70424..ef51d06 100644 --- a/.gitignore +++ b/.gitignore @@ -36,6 +36,7 @@ *.i*86 *.x86_64 *.hex +SAE # Debug files *.dSYM/ @@ -59,7 +60,8 @@ dkms.conf .LSOverride # Icon must end with two \r -Icon +Icon + # Thumbnails ._* diff --git a/SAE b/SAE deleted file mode 100755 index 8630ca6..0000000 Binary files a/SAE and /dev/null differ diff --git a/src/annexe/saeAnnexe.c b/src/annexe/saeAnnexe.c index 562757e..56c7391 100644 --- a/src/annexe/saeAnnexe.c +++ b/src/annexe/saeAnnexe.c @@ -60,16 +60,13 @@ int loadIUT(VilleIUT** tiut){ } int rechercheIUT(VilleIUT* tab[],int lTab,char mot[]){ - printf("CPT1\n"); - /* if(!lTab){ fprintf(stderr,"Erreur, Pas de villes enregistrées !\n"); return -1; } for(int i=0; iVille==mot) return i; + if(!strcmp(tab[i]->Ville,mot)) return i; } - */ return -1; } diff --git a/src/partie1/saeP1.c b/src/partie1/saeP1.c index 850bf6f..8afffcb 100644 --- a/src/partie1/saeP1.c +++ b/src/partie1/saeP1.c @@ -12,7 +12,7 @@ void menuUser(VilleIUT* lvIUT[],int tlogi) { int quit=0; while(!quit) - { + { printf("#--------------------------------------------------------------------#\n"); printf("| |\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("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){ @@ -46,7 +47,7 @@ void menuUser(VilleIUT* lvIUT[],int tlogi) break; case 9: quit=1; - break; + reset(); } } @@ -54,14 +55,14 @@ void menuUser(VilleIUT* lvIUT[],int tlogi) void SearchCityWithIUT(VilleIUT* lvIUT[], int tlogi) { - for (int i=0;iVille); + for (int i=0;iVille); } void DepEachIUT(VilleIUT* lvIUT[], int tlogi) { for (int i=0;iVille); + printf("\n - %s :",lvIUT[i]->Ville); MaillonDep* MaillonAct=lvIUT[i]->ldept; while (MaillonAct!=NULL) { @@ -215,30 +216,38 @@ void creerDep(VilleIUT* tiut[],int tlogi){ scanf("%*c%s",ville); if(ville[0]=='Q' && ville[1]=='\0') return; int noVille=rechercheIUT(tiut,tlogi,ville); - if(noVille<=0){ + if(noVille<0){ fprintf(stderr,"\nVille non existante !\n"); return; } VilleIUT* v=tiut[noVille]; - MaillonDep* m=v->ldept; - while(m->suivant!=NULL) m=m->suivant; - m->suivant=(MaillonDep*)malloc(sizeof(MaillonDep)); - if(m->suivant==NULL){ - perror("malloc"); - exit(errno); + int ck=0; + if(v->ldept==NULL){ + ck=1; + v->ldept=(MaillonDep*)malloc(sizeof(MaillonDep)); + if(v->ldept==NULL){ + perror("malloc"); + exit(errno); + } } - m=m->suivant; - printf("\n\nEntrez le nom du département à créer :"); - char dep[31]; - scanf("%*c%s",dep); - strcpy(m->departement,dep); - printf("\n\nEntrez le nombre de places disponibles dans le département :"); + MaillonDep* m=v->ldept; + if(!ck){ + while(m->suivant!=NULL) m=m->suivant; + m->suivant=(MaillonDep*)malloc(sizeof(MaillonDep)); + if(m->suivant==NULL){ + 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); - printf("\n\nEntrez le nom du responsable de département :"); - char resp[51]; - 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); + printf("\n\nEntrez le nom du responsable de département : \n"); + scanf("%*c"); + fgets(m->resp, 51, stdin); + printf("\n\nLe département %s a bien été ajouté à l'IUT de %s.\n",m->departement,ville); return; } @@ -317,9 +326,7 @@ void creerIUT(VilleIUT* tiut[],int* tlogi){ 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; diff --git a/src/partie2/saeP2.c b/src/partie2/saeP2.c index 6ad1d7f..78d894a 100644 --- a/src/partie2/saeP2.c +++ b/src/partie2/saeP2.c @@ -138,5 +138,5 @@ void ListeCandidat(int nbcandidat,candidat *tcandidat) printf("Candidat non trouvé"); } -//void gestionPhaseCandidatures(); A FAIRE.*/ +//void gestionPhaseCandidatures(); A FAIRE. diff --git a/src/saeMain.c b/src/saeMain.c index a9d7a49..be0c401 100644 --- a/src/saeMain.c +++ b/src/saeMain.c @@ -20,12 +20,10 @@ int main(void) case 'C': reset(); menuUser(tiut,tlogi); - reset(); break; case 'A': reset(); menuAdmin(tiut,&tlogi); - reset(); break; case 'Q': printf("Êtes-vous sûr de vouloir quitter ? (Y pour continuer)\n\n");