diff --git a/sae1-02.c b/sae1-02.c index e4984af..ab3c745 100644 --- a/sae1-02.c +++ b/sae1-02.c @@ -283,141 +283,6 @@ void sauvegarde(VilleIUT *tville[], int nbville) { fclose(fs); } -// MENU PARTIE 1 - -void menuP1Utilisateur(VilleIUT *tabVille[], int nb) { - int choixP1U; - - while (choixP1U >= 1 || choixP1U <= 4) { - printf("\n"); - printf("---------------------- MENU UTILISATEUR -----------------------\n"); - printf("| |\n"); - printf("| 1 - Consulter les villes avec un IUT |\n"); - printf("| 2 - Consulter les départements d'un IUT |\n"); - printf("| 3 - Consulter le nombre de place des départements |\n"); - printf("| 4 - Consulter les IUT possédant un certain département |\n"); - printf("| |\n"); - printf("| 9 - Retour |\n"); - printf("| |\n"); - printf("| Votre choix => "); - scanf("%d", &choixP1U); - printf("---------------------------------------------------------------\n"); - printf("\n"); - switch (choixP1U) { - case 1: - afficheVilleIUT(tabVille, nb); - break; - case 2: - afficheDepartementsIUT(tabVille, nb); - break; - case 3: - affichageville(tabVille, nb); - break; - case 4: - afficheIUTdepParticulier(tabVille, nb); - break; - case 9: - return; - } - } -} - -void menuP1Administrateur(VilleIUT *tabVille[], int nb, listetuinfo *tetu[], int nbEtu, DepartementVille *departementVille) { - int choixP1A = 0; - while (choixP1A >= 1 || choixP1A <= 4) { - printf("\n"); - printf("---------------------- MENU ADMINISTRATEUR -----------------------\n"); - printf("| |\n"); - printf("| 1 - Modifier le nombre de place d'un département |\n"); - printf("| 2 - Créer un département |\n"); - printf("| 3 - Créer un IUT |\n"); - printf("| 4 - Supprimer un département |\n"); - printf("| 5 - Modifier nom responsable |\n"); - printf("| 6 - Lancer analyse candidature |\n"); - printf("| 7 - Afficher liste DES candidatures |\n"); - printf("| |\n"); - printf("| 9 - Retour |\n"); - printf("| Votre choix => "); - scanf("%d", &choixP1A); - printf("------------------------------------------------------------------\n"); - printf("\n"); - switch (choixP1A) { - case 1: - modifPlace(tabVille, nb); - break; - case 2: - ajoutDept(-1, tabVille, nb); - break; - case 3: - ajoutIUT(tabVille, &nb, 100); - break; - case 4: - supprDepartement(tabVille, &nb); - break; - case 5: - modifNomResponsable(tabVille, nb); - break; - case 6: - departementVille = useAllFunctionsCandidature(tetu, nbEtu); - printf("L'analyse et le classement a bien été effectué !\n"); - break; - case 7: - affichealletu(tetu, nbEtu); - break; - case 9: - sauvegarde(tabVille, nb);// mettre menu général - return; - } - } -} - -void menuPrincipal(VilleIUT *tabVille[], int nb, listetuinfo *tetu[], int nbEtu, DepartementVille* departementVille) { - int choix = 0; - while (choix >= 1 || choix <= 4) { - printf("\n"); - printf("---------------------- MENU PRINCIPAL -----------------------\n"); - printf("| |\n"); - printf("| 1 - Utilisateur |\n"); - printf("| 2 - Administrateur |\n"); - printf("| |\n"); - printf("| 9 - Quitter |\n"); - printf("| |\n"); - printf("| Votre choix => "); - scanf("%d", &choix); - printf("-------------------------------------------------------------\n"); - printf("\n"); - switch (choix) { - case 1: - menuP1Utilisateur(tabVille, nb); - break; - case 2: - menuP1Administrateur(tabVille, nb, tetu, nbEtu, departementVille); - break; - case 9: - sauvegarde(tabVille, nb); - //sauvegardeTabRespFichier(tabVille, nb, tabResp); - return; - } - } -} - - - -void test(void){ - #define TAILLEMAX 200 - VilleIUT *tabVille[TAILLEMAX]; - int nb = chargeIUT(tabVille, TAILLEMAX); - - listetuinfo *tetu[TAILLEMAX]; - int nbEtu; - char nomFich[20]; - strcpy( nomFich, "candidature.txt"); - nbEtu = chargeretudiant(nomFich, tetu, 5000); - - DepartementVille* departementVille; - menuPrincipal(tabVille, nb, tetu, nbEtu, departementVille); -} - // Partie 2 //chargement ====================================================================================================================================================================== @@ -604,6 +469,7 @@ void choix(VilleIUT *tville[], int nbville, char choixville[], char choixdep[]){ } } +//ajouter en tete :) Listchoixdept ajoutercarte(Maillonchoix* a, char choixville[], char choixdep[]){ Maillonchoix* carte; carte = (Maillonchoix*)malloc(sizeof(Maillonchoix)); @@ -719,14 +585,19 @@ void modificationcarte(listetuinfo etu, VilleIUT *tville[], int nbville){ //supprimer ========================================================================================================================================== +Maillonchoix* supptete(Listchoixdept carte){ + Maillonchoix *tmp; + tmp=carte->suivant; + free(carte); + return tmp; +} + Maillonchoix* suppressioncartechoix(char choixville[], char choixdep[], Listchoixdept carte){ - Maillonchoix *premier, *tmp; if(carte==NULL){exit(1);} if(strcmp(carte->Ville,choixville)==0){ if(strcmp(choixdep,carte->dep)==0){ - tmp=carte->suivant; - free(carte); - return tmp; + supptete(carte); + exit(1); } } carte = suppressioncartechoix(choixville, choixdep, carte->suivant); @@ -742,19 +613,6 @@ void suppcarte(listetuinfo *etu){ lcarte = suppressioncartechoix(choixville, choixdep, lcarte); }// return nb -1 -//========================================================================================================================================================= - -// zone de test ========================================================================================= - -void test1(void){ - listetuinfo *tetu[5000]; - int nb; - char nomFich[20]; - strcpy( nomFich, "candidature.txt"); - nb = chargeretudiant(nomFich, tetu, 5000); - affichealletu(tetu, nb); -} - //========================================================================================================== // Partie 3 @@ -835,36 +693,32 @@ void afficherDepartementVille(DepartementVille* departementVille) { // Partie 4 - /* V affichage coté candidat de ces infos admis ou pas - - valdier ça candidature refuse les autres + V valdier ça candidature refuse les autres - valider met a jour le dossier candidature - chaque departement peut consulter ça liste d'attente - metre a jour la liste - - - - - - - - - - - + +*/ // coté etu========================================================================================================= // affichage -void affichagedepresultat(Maillonchoix* carte){ +void affichagedepresultat(Maillonchoix* carte, int *suite){ if(carte==NULL){return;} if(carte->decision==1){ printf("%s %s - admis \n", carte.Ville, carte.dep); + *suite=1; } - if(carte->decision==1){ + if(carte->decision==-1){ printf("%s %s - refusé \n", carte.Ville, carte.dep); } - if(carte->decision==1){ + if(carte->decision==2){ printf("%s %s - lsite d'attente \n", carte.Ville, carte.dep); } - affichagedepresultat(carte.suivant); + affichagedepresultat(carte.suivant, suite); } // validation @@ -882,4 +736,185 @@ void validation(char choixville[], char choixdep[], Maillonchoix* carte, int *ok validation(choixville, choixdep, carte.suivant, ok); if(ok==1){ if(carte.decision==1){ -*/ \ No newline at end of file + + +// MENU PARTIE 1 + +void menuValidation(){} + +void menuP1Utilisateur(listetuinfo etu, VilleIUT *tabVille[], int nb) { + int choixP1U; + + while (choixP1U >= 1 || choixP1U <= 4) { + printf("\n"); + printf("---------------------- MENU UTILISATEUR -----------------------\n"); + printf("| |\n"); + printf("| 1 - Consulter les villes avec un IUT |\n"); + printf("| 2 - Consulter les départements d'un IUT |\n"); + printf("| 3 - Consulter le nombre de place des départements |\n"); + printf("| 4 - Consulter les IUT possédant un certain département |\n"); + printf("| 5 - Ajouter un souhait |\n"); + printf("| 6 - Modifer un souhait |\n"); + printf("| 7 - Supprimer un souhait |\n"); + printf("| 8 - Consulter ses informations |\n"); + printf("| 9 - Consulter où l'on est admis |\n"); + printf("| 10 - |\n"); + printf("| 11 - |\n"); + printf("| 12 - |\n"); + printf("| |\n"); + printf("| 15 - Retour |\n"); + printf("| Votre choix => "); + scanf("%d", &choixP1U); + printf("---------------------------------------------------------------\n"); + printf("\n"); + switch (choixP1U) { + case 1: + afficheVilleIUT(tabVille, nb); + break; + case 2: + afficheDepartementsIUT(tabVille, nb); + break; + case 3: + affichageville(tabVille, nb); + break; + case 4: + afficheIUTdepParticulier(tabVille, nb); + break; + case 5: + allajoutprocess(tbVille, etu, nb); + etu->nbchoix = etu->nbchoix+1; + break; + case 6: + modificationcarte(etu, tabville, nb); + break; + case 7: + suppcarte(etu); + etu->nbchoix = etu->nbchoix-1; + break; + case 8: + affichageetu(etu); + break; + case 9: + int suite=0; + affichagedepresultat(etu->lcarte, &suite); + if(suite==1){ + int reponse; + printf("| 1 - valider un veux |\n"); + printf("| autre chiffre pour sortir |\n"); + printf("| =>"); + scanf("%d", &reponse); + if(reponse==1){menuValidation();} + } + break; + case 15: + return; + } + } +} + +void questiondepartement (){ + +} + +void menuP1Administrateur(VilleIUT *tabVille[], int nb, listetuinfo *tetu[], int nbEtu, DepartementVille *departementVille) { + int choixP1A = 0; + while (choixP1A >= 1 || choixP1A <= 4) { + printf("\n"); + printf("---------------------- MENU ADMINISTRATEUR -----------------------\n"); + printf("| |\n"); + printf("| 1 - Modifier le nombre de place d'un département |\n"); + printf("| 2 - Créer un département |\n"); + printf("| 3 - Créer un IUT |\n"); + printf("| 4 - Supprimer un département |\n"); + printf("| 5 - Modifier nom responsable |\n"); + printf("| 6 - Lancer analyse candidature |\n"); + printf("| 7 - Afficher liste DES candidatures |\n"); + printf("| 8 - Afficher liste des candidats par départements |\n"); + printf("| |\n"); + printf("| 15 - Retour |\n"); + printf("| Votre choix => "); + scanf("%d", &choixP1A); + printf("------------------------------------------------------------------\n"); + printf("\n"); + switch (choixP1A) { + case 1: + modifPlace(tabVille, nb); + break; + case 2: + ajoutDept(-1, tabVille, nb); + break; + case 3: + ajoutIUT(tabVille, &nb, 100); + break; + case 4: + supprDepartement(tabVille, &nb); + break; + case 5: + modifNomResponsable(tabVille, nb); + break; + case 6: + departementVille = useAllFunctionsCandidature(tetu, nbEtu); + printf("L'analyse et le classement a bien été effectué !\n"); + break; + case 7: + affichealletu(tetu, nbEtu); + break; + case 8: + break; + case 15: + sauvegarde(tabVille, nb);// mettre menu général + return; + } + } +} + +void menuPrincipal(VilleIUT *tabVille[], int nb, listetuinfo *tetu[], int nbEtu, DepartementVille* departementVille, char nomFich[]) { + int choix = 0, ligneetu; + while (choix >= 1 || choix <= 4) { + printf("\n"); + printf("---------------------- MENU PRINCIPAL -----------------------\n"); + printf("| |\n"); + printf("| 1 - Utilisateur |\n"); + printf("| 2 - Administrateur |\n"); + printf("| |\n"); + printf("| 9 - Quitter |\n"); + printf("| |\n"); + printf("| Votre choix => "); + scanf("%d", &choix); + printf("-------------------------------------------------------------\n"); + printf("\n"); + switch (choix) { + case 1: + printf("| - quel est votre numéro de candidat ?\n| =>"); + scanf("%d", &num); + ligneetu = recherdicoetu(tetu, nbEtu, num); + menuP1Utilisateur(tetu[ligneetu], tabVille, nb); + break; + case 2: + menuP1Administrateur(tabVille, nb, tetu, nbEtu, departementVille); + break; + case 9: + sauvegarde(tabVille, nb); + //sauvegardeTabRespFichier(tabVille, nb, tabResp); + enregistrementetudiants(nomFich, tetu, nbEtu) + return; + } + } +} + + + +void test(void){ + #define TAILLEMAX 200 + VilleIUT *tabVille[TAILLEMAX]; + int nb = chargeIUT(tabVille, TAILLEMAX); + + listetuinfo *tetu[TAILLEMAX]; + int nbEtu; + char nomFich[20]; + strcpy( nomFich, "candidature.txt"); + nbEtu = chargeretudiant(nomFich, tetu, 5000); + + DepartementVille* departementVille; + menuPrincipal(tabVille, nb, tetu, nbEtu, departementVille, nomFich); +} diff --git a/sae1-02.h b/sae1-02.h index 8256387..55f73c7 100644 --- a/sae1-02.h +++ b/sae1-02.h @@ -136,5 +136,5 @@ void test(void); void test1(void); void menuP1Utilisateur(VilleIUT *v[], int nb); -void menuPrincipal(VilleIUT *tabVille[], int nb, listetuinfo *tetu[], int nbEtu, DepartementVille* departementVille); -void menuP1Administrateur(VilleIUT *tabVille[], int nb, listetuinfo *tetu[], int nbEtu, DepartementVille* departementVille); \ No newline at end of file +void menuP1Administrateur(VilleIUT *tabVille[], int nb, listetuinfo *tetu[], int nbEtu, DepartementVille* departementVille); +void menuPrincipal(VilleIUT *tabVille[], int nb, listetuinfo *tetu[], int nbEtu, DepartementVille* departementVille, char nomFich[]); \ No newline at end of file