diff --git a/SAE.h b/SAE.h index b61b964..b853165 100755 --- a/SAE.h +++ b/SAE.h @@ -13,6 +13,7 @@ void menuUtilisateur(VilleIUT *tiut[], int *nbIUT, Etudiant *tetud[], int *nbCan void menuCandidat(VilleIUT *tiut[], int *nbIUT, Etudiant *tetud[], int *nbCandidats); void menuResponsable(Etudiant *tetud[], int nbCandidats, VilleIUT *tiut[], int *nbIUT, Etudiant *tetudAdmis[], int nbEtudAdmis, Etudiant *tetudAttente[], int nbEtudAttente); void menuAffichage(Etudiant *tetudResp[], int nbCandidatsDept); +void menuPostCandidat(Etudiant *tetud[], int *nbCandidats); /* Partie 1 */ @@ -88,5 +89,5 @@ void sauvegardeTousCandidats(Etudiant *tetud[], int nbCandidats); void libererEspaceCandidats(Etudiant *tetud[], int nbCandidats); void libererEspaceIUT(VilleIUT *tiut[], int nbIUT); -void chargerMdPAdmin(); +char *chargerMdPAdmin(); void modifierMdPAdmin(); \ No newline at end of file diff --git a/administrateur.c b/administrateur.c index 9be1efa..ded7698 100644 --- a/administrateur.c +++ b/administrateur.c @@ -156,35 +156,35 @@ void stopperPhaseCandidature(bool *phaseCandidature, bool *phaseTraitement) } } -void chargerMdPAdmin() -{ - FILE *flot; - flot = fopen("mdpAdmin.bin", "rb"); - if (flot == NULL) - { - printf("Erreur lors de l'ouverture du fichier mdpAdmin.bin\n"); - exit(1); - } - char mdp[30]; - fread(mdp, sizeof(char), 30, flot); - printf("Le mot de passe de l'administrateur est : %s\n", mdp); - fclose(flot); -} +// char *chargerMdPAdmin(void) +// { +// FILE *flot; +// flot = fopen("mdpAdmin.bin", "rb"); +// if (flot == NULL) +// { +// printf("Erreur lors de l'ouverture du fichier mdpAdmin.bin\n"); +// exit(1); +// } +// char mdp[30]; +// fread(mdp, sizeof(char), 30, flot); +// fclose(flot); +// return mdp; +// } -void modifierMdPAdmin() -{ - char mdp[30]; - FILE *flot; - flot = fopen("mdpAdmin.bin", "wb"); - if (flot == NULL) - { - printf("Erreur lors de l'ouverture du fichier mdpAdmin.txt\n"); - return; - } - printf("Entrez le nouveau mot de passe de l'administrateur :\n> "); - fgets(mdp, 30, stdin); - mdp[strlen(mdp) - 1] = '\0'; - fwrite(mdp, sizeof(char), strlen(mdp) + 1, flot); - fprintf(flot, "\n"); - fclose(flot); -} \ No newline at end of file +// void modifierMdPAdmin(void) +// { +// char mdp[30]; +// FILE *flot; +// flot = fopen("mdpAdmin.bin", "wb"); +// if (flot == NULL) +// { +// printf("Erreur lors de l'ouverture du fichier mdpAdmin.txt\n"); +// return; +// } +// printf("Entrez le nouveau mot de passe de l'administrateur :\n> "); +// fgets(mdp, 30, stdin); +// mdp[strlen(mdp) - 1] = '\0'; +// fwrite(mdp, sizeof(char), strlen(mdp) + 1, flot); +// fprintf(flot, "\n"); +// fclose(flot); +// } \ No newline at end of file diff --git a/candidats.txt b/candidats.txt old mode 100755 new mode 100644 index f76a9e1..1c1541b --- a/candidats.txt +++ b/candidats.txt @@ -1,4 +1,4 @@ -3 +17 1 Dufour Albert @@ -15,7 +15,7 @@ Jacques 2 Clermont-Ferrand Informatique --1 +1 0 Grenoble Informatique @@ -28,5 +28,140 @@ Kyllian 1 Clermont-Ferrand Informatique -2 +1 +0 +4 + +5 +Syxhectumtoelqukzpwf +bhlkbyciwrhlfivkebdd +12.00 14.00 10.00 11.00 +5 +Clermont-Ferrand +Informatique +0 +0 +Clermont-Ferrand +Biologie +0 +0 +Clermont-Ferrand +Physique +0 +0 +Clermont-Ferrand +Orthophonie +0 +0 +Clermont-Ferrand +Mécanique +1 +0 +6 +Fixfgiwdofvbifycdlcz +odmawpdykpsusroqpxoa +19.00 17.00 16.00 13.00 +1 +Clermont-Ferrand +Informatique +1 +0 +7 +Rfjoobupljzqmdicrify +hnkrcoybitnxwvclnyvg +16.00 18.00 17.00 18.00 +1 +Clermont-Ferrand +Informatique +1 +0 +8 +Srhtwifhihibelhekawk +vxzgzzamagajakqtarnn +9.00 4.00 1.00 1.00 +1 +Clermont-Ferrand +Informatique +1 +0 +9 +Jwkohlryrvohsinxiydx +busiowupqksdxaqwlkae +12.00 14.00 17.00 13.00 +1 +Clermont-Ferrand +Biologie +0 +0 +10 +Jwkyzytnjdeqmdffiall +sesqpdhjmmefsakiiiko +18.00 13.00 13.00 16.00 +1 +Clermont-Ferrand +Informatique +1 +0 +11 +Rloskotffonxfaynfvcd +salfgwqjsqfhplxyoddh +20.00 16.00 16.00 16.00 +1 +Clermont-Ferrand +Informatique +1 +0 +12 +Vcoasquekksbwpycjrjy +glrgfpsolfdxakcuvgce +13.00 10.00 12.00 16.00 +1 +Clermont-Ferrand +Informatique +1 +0 +13 +Xsquckmpafhxgmtwumgx +fcslnbyurokmoahorklj +5.00 3.00 8.00 11.00 +1 +Clermont-Ferrand +Informatique +1 +0 +14 +Fzwbocpjoridledsvwoa +aqvmuaibcczntuuenjml +12.00 2.00 15.00 7.00 +1 +Clermont-Ferrand +Informatique +1 +0 +15 +Sfqmubrttvzivkbhkcex +zhwebntzdyusvxzwkhrg +14.00 10.00 16.00 10.00 +1 +Clermont-Ferrand +Informatique +1 +0 +16 +Cgtgjhaghulbyfaxopqe +pyoswmaodbueeotnrpfr +18.00 16.00 19.00 14.00 +1 +Clermont-Ferrand +Informatique +1 +0 +17 +Urbzuiprnczywaghjrpn +khuehsvngskkynrlgbww +16.00 15.00 13.00 12.00 +1 +Clermont-Ferrand +Informatique +1 0 diff --git a/candidatst.txt b/candidatst.txt new file mode 100755 index 0000000..4b8c777 --- /dev/null +++ b/candidatst.txt @@ -0,0 +1,174 @@ +17 +1 +Dufour +Albert +19.00 4.00 16.00 3.00 +1 +Clermont-Ferrand +Informatique +1 +0 +2 +Michel +Jacques +7.00 6.00 15.00 20.00 +2 +Clermont-Ferrand +Informatique +-1 +0 +Grenoble +Informatique +0 +0 +3 +Chabanon +Kyllian +20.00 20.00 20.00 20.00 +1 +Clermont-Ferrand +Informatique +2 +0 +4 +Chabanonfg +Kyllianfg +20.00 20.00 20.00 20.00 +1 +Issoire +Biologie +0 +0 +5 +Syxhectumtoelqukzpwf +bhlkbyciwrhlfivkebdd +12 14 10 11 +5 +Clermont-Ferrand +Informatique +0 +0 +Clermont-Ferrand +Biologie +0 +0 +Clermont-Ferrand +Physique +0 +0 +Clermont-Ferrand +Orthophonie +0 +0 +Clermont-Ferrand +Mécanique +0 +0 +6 +Fixfgiwdofvbifycdlcz +odmawpdykpsusroqpxoa +19 17 16 13 +1 +Clermont-Ferrand +Informatique +0 +0 +7 +Rfjoobupljzqmdicrify +hnkrcoybitnxwvclnyvg +16 18 17 18 +1 +Clermont-Ferrand +Informatique +0 +0 +8 +Srhtwifhihibelhekawk +vxzgzzamagajakqtarnn +9 4 1 1 +1 +Clermont-Ferrand +Informatique +0 +0 +9 +Jwkohlryrvohsinxiydx +busiowupqksdxaqwlkae +12 14 17 13 +1 +Clermont-Ferrand +Biologie +0 +0 +10 +Jwkyzytnjdeqmdffiall +sesqpdhjmmefsakiiiko +18 13 13 16 +1 +Clermont-Ferrand +Informatique +0 +0 +11 +Rloskotffonxfaynfvcd +salfgwqjsqfhplxyoddh +20 16 16 16 +1 +Clermont-Ferrand +Informatique +0 +0 +12 +Vcoasquekksbwpycjrjy +glrgfpsolfdxakcuvgce +13 10 12 16 +1 +Clermont-Ferrand +Informatique +0 +0 +13 +Xsquckmpafhxgmtwumgx +fcslnbyurokmoahorklj +5 3 8 11 +1 +Clermont-Ferrand +Informatique +0 +0 +14 +Fzwbocpjoridledsvwoa +aqvmuaibcczntuuenjml +12 2 15 7 +1 +Clermont-Ferrand +Informatique +0 +0 +15 +Sfqmubrttvzivkbhkcex +zhwebntzdyusvxzwkhrg +14 10 16 10 +1 +Clermont-Ferrand +Informatique +0 +0 +16 +Cgtgjhaghulbyfaxopqe +pyoswmaodbueeotnrpfr +18 16 19 14 +1 +Clermont-Ferrand +Informatique +0 +0 +17 +Urbzuiprnczywaghjrpn +khuehsvngskkynrlgbww +16 15 13 12 +1 +Clermont-Ferrand +Informatique +0 +0 diff --git a/dptInfos.txt b/dptInfos.txt deleted file mode 100644 index f76a9e1..0000000 --- a/dptInfos.txt +++ /dev/null @@ -1,32 +0,0 @@ -3 -1 -Dufour -Albert -19.00 4.00 16.00 3.00 -1 -Clermont-Ferrand -Informatique -1 -0 -2 -Michel -Jacques -7.00 6.00 15.00 20.00 -2 -Clermont-Ferrand -Informatique --1 -0 -Grenoble -Informatique -0 -0 -3 -Chabanon -Kyllian -20.00 20.00 20.00 20.00 -1 -Clermont-Ferrand -Informatique -2 -0 diff --git a/menus.c b/menus.c index 3ae9570..c0b94ec 100755 --- a/menus.c +++ b/menus.c @@ -24,9 +24,9 @@ */ void menu(VilleIUT *tiut[], int *nbIUT, Etudiant *tetud[], int *nbCandidats, bool *phaseCandidatures, bool *phaseTraitement, Etudiant *tetudAdmis[], int *nbEtudAdmis, Etudiant *tetudAttente[], int *nbEtudAttente) { - int choix; + int choix, pasMdP = 0; bool c = false; - char etat[8]; + char etat[8], mdp[30], MdPAdmin[30]; while (c == false) { if (*phaseCandidatures == true) @@ -37,31 +37,30 @@ void menu(VilleIUT *tiut[], int *nbIUT, Etudiant *tetud[], int *nbCandidats, boo { strcpy(etat, "fermée"); } - // system("clear"); printf("\n\nVeuillez choisir votre menu :\n"); printf("\t1 - Menu administrateur\n"); printf("\t2 - Menu utilisateur\n"); printf("\t3 - Menu candidat (phase de candidature %s)\n", etat); printf("\t4 - Menu responsable de département\n"); + printf("\t5 - Menu POST Candidatures\n"); printf("\t9 - Quitter\n"); printf("\nEntrez votre choix :\n> "); scanf("%d%*c", &choix); switch (choix) { case 1: - // char mdp[30], MdPAdmin[30]; - // int i = 0; // strcpy(MdPAdmin, chargerMdPAdmin()); // printf("Veuillez entrer le mot de passe administrateur :\n> "); // while(mdp != MdPAdmin) // { - // if(i == 3) + // if(pasMdP == 3) // { // printf("Vous avez entré 3 fois le mauvais mot de passe, veuillez réessayer plus tard.\n"); + // return; // } // printf("Veuillez entrer le mot de passe administrateur :\n> "); // scanf("%s%*c", mdp); - // i++; + // pasMdP++; // } menuAdministrateur(tiut, nbIUT, tetud, nbCandidats, phaseCandidatures, phaseTraitement); break; @@ -79,9 +78,9 @@ void menu(VilleIUT *tiut[], int *nbIUT, Etudiant *tetud[], int *nbCandidats, boo case 4: menuResponsable(tetud, *nbCandidats, tiut, nbIUT, tetudAdmis, *nbEtudAdmis, tetudAttente, *nbEtudAttente); break; - // case 5: - // menuPostCandidat(); - // break; + case 5: + menuPostCandidat(tetud, nbCandidats); + break; case 9: c = true; return; @@ -109,7 +108,6 @@ void menuAdministrateur(VilleIUT *tiut[], int *nbIUT, Etudiant *tetud[], int *nb bool c = false; while (c == false) { - // system("clear"); printf("\n\nMenu d'administrateur : Que voulez-vous faire ?\n"); printf("\t1 - Modifier le nombre de places dans un département\n"); printf("\t2 - Créer un département dans un IUT\n"); @@ -174,7 +172,6 @@ void menuUtilisateur(VilleIUT *tiut[], int *nbIUT, Etudiant *tetud[], int *nbCan bool c = false; while (c == false) { - // system("clear"); printf("\n\nMenu d'utilisateur : Que voulez-vous faire ?\n"); printf("\t1 - Voir les villes possédant un IUT\n"); printf("\t2 - Voir les départements dans chaque IUT\n"); @@ -222,7 +219,6 @@ void menuCandidat(VilleIUT *tiut[], int *nbIUT, Etudiant *tetud[], int *nbCandid bool c = false; while (c == false) { - // system("clear"); printf("\n\nMenu candidat : Que voulez-vous faire ?\n"); printf("\t1 - S'inscrire\n"); printf("\t2 - Afficher ses informations\n"); @@ -281,7 +277,6 @@ void menuResponsable(Etudiant *tetud[], int nbCandidats, VilleIUT *tiut[], int * triNote(tetudResp, nbCandidatsDept); while (c == false) { - // system("clear"); printf("\n\nMenu des Responsable de Departement : Que voulez-vous faire ?\n"); printf("\t1 - Affichages\n"); printf("\t2 - Modifier le nombre de places dans un département\n"); @@ -302,8 +297,9 @@ void menuResponsable(Etudiant *tetud[], int nbCandidats, VilleIUT *tiut[], int * *noteMin = modifNoteMin(noteMin); break; case 4: - modifStatueCandidat(tetudResp, nbCandidatsDept, noteMin, tiut, *nbIUT, respVille, respDept); //! A verifier - statueCandidat(tetud, nbCandidats, tetudAdmis, tetudAttente, nbEtudAdmis, nbEtudAttente); + modifStatueCandidat(tetudResp, nbCandidatsDept, noteMin, tiut, *nbIUT, respVille, respDept); //! Les valeurs ne se return pas + statueCandidat(tetudResp, nbCandidatsDept, tetudAdmis, tetudAttente, nbEtudAdmis, nbEtudAttente); + afficherCandidats(tetudAdmis, nbEtudAdmis); break; case 9: c = true; @@ -378,33 +374,28 @@ void menuAffichage(Etudiant *tetudResp[], int nbCandidatsDept) } } -// void menuPostCandidat() -// { -// int choix; -// bool c = false; -// while (c == false) -// { -// printf("\n\nMenu des Affichages Responsable de Departement : Que voulez-vous faire ?\n"); -// printf("\t1 - Afficher les informations sur mes voeus\n"); -// printf("\t2 - Validation d'un voeux (et refus des autres)\n"); -// printf("\t9 - Quitter\n"); -// printf("\nEntrez votre choix :\n> "); -// scanf("%d%*c", &choix); -// switch (choix) -// { -// case 1: -// afficherCandidat(tetud, *nbCandidats); -// break; -// case 2: -// ValidationCandidature();//** Valide une candidature et rejette ttes les autres ==> enregistre dans tblAdmis et tblAttente -// MiseAJourAdmission();//** relance l'admission -// break; -// case 9: -// c = true; -// return; -// default: -// printf("Option non reconnue. Veuillez recommencer.\n"); -// break; -// } -// } -// } \ No newline at end of file +void menuPostCandidat(Etudiant *tetud[], int *nbCandidats) +{ + int choix; + bool c = false; + while (c == false) + { + printf("\n\nMenu des Affichages Responsable de Departement : Que voulez-vous faire ?\n"); + printf("\t1 - Afficher les informations sur mes voeus\n"); + printf("\t9 - Quitter\n"); + printf("\nEntrez votre choix :\n> "); + scanf("%d%*c", &choix); + switch (choix) + { + case 1: + afficherCandidat(tetud, *nbCandidats); + break; + case 9: + c = true; + return; + default: + printf("Option non reconnue. Veuillez recommencer.\n"); + break; + } + } +} \ No newline at end of file diff --git a/responsable.c b/responsable.c index 0bde253..630a3d0 100644 --- a/responsable.c +++ b/responsable.c @@ -82,14 +82,18 @@ Etudiant modifStatueCandidat(Etudiant *tetud[], int nbCandidats, float noteMin[] { if (tetud[i]->tabNotes[maths] >= noteMin[maths] && tetud[i]->tabNotes[francais] >= noteMin[francais] && tetud[i]->tabNotes[anglais] >= noteMin[anglais] && tetud[i]->tabNotes[spe] >= noteMin[spe] && tetud[i]->tabNotes[moy] >= noteMin[moy] && nbCandidatsAdmis(tetud, nbCandidats) <= getNbP(tiut[posIUT]->ldept, posDept)) { + printf("test 111111 \n"); + printf("nbCandidatsAdmis(tetud, nbCandidats) = %d\n", nbCandidatsAdmis(tetud, nbCandidats)); tetud[i]->lChoix->choix.decisionAdmission = 1; } else if (tetud[i]->tabNotes[maths] >= noteMin[maths] && tetud[i]->tabNotes[francais] >= noteMin[francais] && tetud[i]->tabNotes[anglais] >= noteMin[anglais] && tetud[i]->tabNotes[spe] >= noteMin[spe] && tetud[i]->tabNotes[moy] >= noteMin[moy] && nbCandidatsAdmis(tetud, nbCandidats) > getNbP(tiut[posIUT]->ldept, posDept)) { + printf("test 222222 \n"); tetud[i]->lChoix->choix.decisionAdmission = 2; } else { + printf("test 333333 \n"); tetud[i]->lChoix->choix.decisionAdmission = -1; } } @@ -112,23 +116,11 @@ int statueCandidat(Etudiant *tetud[], int nbCandidats, Etudiant *tetudAdmis[], E nbEtudAttente++; } } + afficherCandidats(tetudAdmis, nbEtudAdmis); + printf("------------------------\n"); + afficherCandidats(tetudAttente, nbEtudAttente); } -// Etudiant ValidationCandidature() -// { -// int i; -// char choix[30]; -// printf("Quel voeu souhaitez-vous valider ?\n"); -// scanf("%s", &choix); -// for (i = 0; i < nbCandidats; i++) -// { -// if (tetud[i]->lChoix->choix.decisionAdmission == 1) -// { -// tetud[i]->lChoix->choix.decisionAdmission = 0; -// } -// } -// } - int nbCandidatsAdmis(Etudiant *tetud[], int nbCandidats) { int nbAdmis = 0; diff --git a/resultats.txt b/resultats.txt new file mode 100644 index 0000000..d497d7b --- /dev/null +++ b/resultats.txt @@ -0,0 +1,174 @@ +3 +1 +Dufour +Albert +19.00 4.00 16.00 3.00 +1 +Clermont-Ferrand +Informatique +1 +0 +2 +Michel +Jacques +7.00 6.00 15.00 20.00 +2 +Clermont-Ferrand +Informatique +-1 +0 +Grenoble +Informatique +0 +0 +3 +Chabanon +Kyllian +20.00 20.00 20.00 20.00 +1 +Clermont-Ferrand +Informatique +2 +0 +4 +Chabanonfg +Kyllianfg +20.00 20.00 20.00 20.00 +1 +Issoire +Biologie +0 +0 +5 +Syxhectumtoelqukzpwf +bhlkbyciwrhlfivkebdd +12 14 10 11 +5 +Clermont-Ferrand +Informatique +0 +0 +Clermont-Ferrand +Biologie +0 +0 +Clermont-Ferrand +Physique +0 +0 +Clermont-Ferrand +Orthophonie +0 +0 +Clermont-Ferrand +Mécanique +0 +0 +6 +Fixfgiwdofvbifycdlcz +odmawpdykpsusroqpxoa +19 17 16 13 +1 +Clermont-Ferrand +Informatique +0 +0 +7 +Rfjoobupljzqmdicrify +hnkrcoybitnxwvclnyvg +16 18 17 18 +1 +Clermont-Ferrand +Informatique +0 +0 +8 +Srhtwifhihibelhekawk +vxzgzzamagajakqtarnn +9 4 1 1 +1 +Clermont-Ferrand +Informatique +0 +0 +9 +Jwkohlryrvohsinxiydx +busiowupqksdxaqwlkae +12 14 17 13 +1 +Clermont-Ferrand +Biologie +0 +0 +10 +Jwkyzytnjdeqmdffiall +sesqpdhjmmefsakiiiko +18 13 13 16 +1 +Clermont-Ferrand +Informatique +0 +0 +11 +Rloskotffonxfaynfvcd +salfgwqjsqfhplxyoddh +20 16 16 16 +1 +Clermont-Ferrand +Informatique +0 +0 +12 +Vcoasquekksbwpycjrjy +glrgfpsolfdxakcuvgce +13 10 12 16 +1 +Clermont-Ferrand +Informatique +0 +0 +13 +Xsquckmpafhxgmtwumgx +fcslnbyurokmoahorklj +5 3 8 11 +1 +Clermont-Ferrand +Informatique +0 +0 +14 +Fzwbocpjoridledsvwoa +aqvmuaibcczntuuenjml +12 2 15 7 +1 +Clermont-Ferrand +Informatique +0 +0 +15 +Sfqmubrttvzivkbhkcex +zhwebntzdyusvxzwkhrg +14 10 16 10 +1 +Clermont-Ferrand +Informatique +0 +0 +16 +Cgtgjhaghulbyfaxopqe +pyoswmaodbueeotnrpfr +18 16 19 14 +1 +Clermont-Ferrand +Informatique +0 +0 +17 +Urbzuiprnczywaghjrpn +khuehsvngskkynrlgbww +16 15 13 12 +1 +Clermont-Ferrand +Informatique +0 +0