diff --git a/SAE.h b/SAE.h index 029b24e..c765438 100755 --- a/SAE.h +++ b/SAE.h @@ -4,10 +4,11 @@ #include #include "structures.h" +void global(void); /* Menus */ -void choixMenu(ListeDept *tiut[]); -void menuUtilisateur(ListeDept *tiut[]); -void menuAdministrateur(ListeDept *tiut[]); +void menu(VilleIUT *tiut[], int nbVilles); +void menuUtilisateur(VilleIUT *tiut[], int nbVilles); +void menuAdministrateur(VilleIUT *tiut[], int nbVilles); /* Partie 1 */ ListeDept listenouv(void); diff --git a/TEST.c b/TEST.c index 3e55cdc..4f5d33e 100644 --- a/TEST.c +++ b/TEST.c @@ -2,16 +2,6 @@ int main(void) { - int nbVilles; - VilleIUT *tiut[100]; - nbVilles = chargementVillesIUT(tiut); - // affichageVillesIUT(tiut, nbVilles); - affichageDeptIUT(tiut, nbVilles); - // modificationNbPDept(tiut, nbVilles); - // creationDept(tiut, nbVilles); - // nbVilles = suppressionDept(tiut, nbVilles); - //modificationRespDept(tiut, nbVilles); - //affichageDeptIUT(tiut, nbVilles); - sauvegarde(tiut, nbVilles); + global(); return 0; } diff --git a/exe b/exe index 1e1cebf..42c130f 100755 Binary files a/exe and b/exe differ diff --git a/global.c b/global.c index 8532777..d68b96e 100755 --- a/global.c +++ b/global.c @@ -2,6 +2,9 @@ void global(void) { - + int nbVilles; + VilleIUT *tiut[100]; + nbVilles = chargementVillesIUT(tiut); + menu(tiut, nbVilles); + sauvegarde(tiut, nbVilles); } - diff --git a/informationsIUT.txt b/informationsIUT.txt index 468d925..1deab77 100755 --- a/informationsIUT.txt +++ b/informationsIUT.txt @@ -1,4 +1,4 @@ Grenoble Informatique 112 Dupont Jean Clermont-Ferrand Biologie 120 Coralie Elebon Clermont-Ferrand Informatique 136 Simon Carine -Aurillac Bio-Informatique 56 Ayoub Milaki +Aurillac Bio-Informatique 56 Ayoub Milaki \ No newline at end of file diff --git a/menus.c b/menus.c index b6695c6..1131f17 100755 --- a/menus.c +++ b/menus.c @@ -1,13 +1,13 @@ #include "SAE.h" -void choixMenu(ListeDept *tiut[]) +void menu(VilleIUT *tiut[], int nbVilles) { int choix; bool c = false; while (c == false) { - system("clear"); - printf("Veuillez choisir votre menu :\n"); + // system("clear"); + printf("\n\nVeuillez choisir votre menu :\n"); printf("\t1 - Menu utilisateur\n"); printf("\t2 - Menu administrateur\n"); printf("\t9 - Quitter\n"); @@ -16,15 +16,16 @@ void choixMenu(ListeDept *tiut[]) switch (choix) { case 1: - c = true; - menuUtilisateur(tiut); + c = false; + menuUtilisateur(tiut, nbVilles); break; case 2: - c = true; - menuAdministrateur(tiut); + c = false; + menuAdministrateur(tiut, nbVilles); break; case 9: c = true; + return; break; default: printf("Option non reconnue. Veuillez recommencer.\n"); @@ -33,14 +34,14 @@ void choixMenu(ListeDept *tiut[]) } } -void menuUtilisateur(ListeDept *tiut[]) +void menuUtilisateur(VilleIUT *tiut[], int nbVilles) { int choix; bool c = false; while (c == false) { - system("clear"); - printf("Menu d'utilisateur : Que voulez-vous faire ?\n"); + // 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"); printf("\t3 - Voir le nombre de places en première année\n"); @@ -51,24 +52,24 @@ void menuUtilisateur(ListeDept *tiut[]) switch (choix) { case 1: - c = true; - // affichageVillesIUT(VilleIUT *tiut[], int nb); + c = false; + affichageVillesIUT(tiut, nbVilles); break; case 2: - c = true; - // affichageDeptIUT(VilleIUT *tiut[], int nb); + c = false; + affichageDeptIUT(tiut, nbVilles); break; case 3: - c = true; + c = false; // break; case 4: - c = true; + c = false; // break; case 9: c = true; - return choixMenu(tiut); + return menu(tiut, nbVilles); default: printf("Option non reconnue. Veuillez recommencer.\n"); break; @@ -76,14 +77,14 @@ void menuUtilisateur(ListeDept *tiut[]) } } -void menuAdministrateur(ListeDept *tiut[]) +void menuAdministrateur(VilleIUT *tiut[], int nbVilles) { int choix; bool c = false; while (c == false) { - system("clear"); - printf("Menu d'administrateur : Que voulez-vous faire ?\n"); + // 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"); printf("\t3 - Supprimer un département d'un IUT\n"); @@ -96,31 +97,32 @@ void menuAdministrateur(ListeDept *tiut[]) switch (choix) { case 1: - c = true; - // modificationNbPDept(tiut, nb); + c = false; + modificationNbPDept(tiut, nbVilles); break; case 2: - c = true; - // creationDept(tiut[], nb); + c = false; + creationDept(tiut, nbVilles); break; case 3: - c = true; - // suppressionDept(tiut[], nb); + c = false; + suppressionDept(tiut, nbVilles); break; case 4: - c = true; - // modificationRespDept(tiut, nb); + c = false; + modificationRespDept(tiut, nbVilles); break; case 5: - c = true; + c = false; // break; case 6: - c = true; + c = false; // break; case 9: - return choixMenu(tiut); + c = true; + return menu(tiut, nbVilles); break; default: printf("Option non reconnue. Veuillez recommencer.\n"); diff --git a/partie1.c b/partie1.c index f1cc63b..7306b67 100755 --- a/partie1.c +++ b/partie1.c @@ -1,16 +1,5 @@ #include "SAE.h" -/* -ListeDept chargeListeDept(VilleIUT *tiut[]) -{ - int i = 0; - ListeDept liste = listenouv(); - FILE *file = fopen("informationsIUT.txt", "r"); - while (!feof(file)) - { - } -}*/ - int chargementVillesIUT(VilleIUT *tiut[]) { FILE *file = fopen("informationsIUT.txt", "r");