From b4085a0e344dc51c7213be7db68e8751bd27beb1 Mon Sep 17 00:00:00 2001 From: Roxane ROSSETTO Date: Sat, 24 Dec 2022 11:32:03 +0100 Subject: [PATCH] =?UTF-8?q?avanc=C3=A9=20partie=201?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- part1.c | 21 +++++++++++++-------- part1.don | 25 +++++++++++++++---------- part1.h | 5 ++++- 3 files changed, 32 insertions(+), 19 deletions(-) diff --git a/part1.c b/part1.c index 2e5c610..26d50fe 100644 --- a/part1.c +++ b/part1.c @@ -132,7 +132,7 @@ void AffnbPdpt ( MaillonDept *dpt )//Affiche nombre de place par département d' { if ( dpt == NULL) return; printf("%s \t%d \n", dpt->departement, dpt->nbP); - AfficheDpmt(dpt->suiv); + AffnbPdpt(dpt->suiv); } void affichenbPIUT (VilleIUT *iut)//Affiche nombre de place restante d'un iut avec ses départements @@ -141,12 +141,12 @@ void affichenbPIUT (VilleIUT *iut)//Affiche nombre de place restante d'un iut av AffnbPdpt(iut->ldept); } -void AffichenbPtableau(VilleIUT ** TabIUT, int n )//Affiche le tableau de places restantes des iuts avec leurs départements +void AffichenbPtableau(VilleIUT ** TIUT, int n )//Affiche le tableau de places restantes des iuts avec leurs départements { int i; for ( i = 0 ; i < n ; i++ ) - if ( TabIUT[i]->nbDept > 0) - affichenbPIUT(TabIUT[i]); + if ( TIUT[i]->nbDept > 0) + affichenbPIUT(TIUT[i]); } @@ -434,10 +434,11 @@ MaillonDept * ldepart; printf("*--------------------4-Retour-----------------------*\n"); printf("*****************************************************\n"); - scanf("%d", &reponse); + scanf("%d", &reponse);//enregistrement du choix printf("%d", reponse); - while ( reponse == 1 || reponse == 2 || reponse == 3 || reponse == 4){ + while ( reponse == 1 || reponse == 2 || reponse == 3 || reponse == 4){ // tant que le choix fait partie de ces propositions if ( reponse == 1 ){ + printf("Ville/départements \t Places dispo \t\t Responsable\n"); Affichetableau(tV, nb); return 0; } @@ -446,12 +447,14 @@ MaillonDept * ldepart; return 0; } if ( reponse == 3){ - printf("Quel departement souhaitez vous integrer?\n"); + printf("Quel departement souhaiteriez vous integrer?\n"); scanf("%s", rdpt); + printf("%s\n", rdpt ); + AfficheDpmt(tV[nb]->ldept); for ( i = 0 ; i < nb ; i++){ ldepart = recherche (tV[i]->ldept, rdpt); - AfficheDpmt(ldepart); } + AfficheDpmt(ldepart); return 0; } if ( reponse == 4 ) @@ -480,6 +483,7 @@ void test (void){ // fonction globale if (acc == 1){ repAdm = Admin (tV, nbville); + } if (acc == 2){ repVis = utilisateur (tV, nbville); @@ -498,6 +502,7 @@ void test (void){ // fonction globale + /* SOUCIS AVEC LA FONCTION TEST, JE N'ARRIVE PAS A SORTIR DU WHILE POUR RETOURNER AU MENU PRINCIPAL ADMIN/ VISITEUR. FONCTION RECURCIVE? diff --git a/part1.don b/part1.don index 9c7fe10..6828423 100644 --- a/part1.don +++ b/part1.don @@ -1,18 +1,23 @@ Grenoble 3 -Informatique---- 112 Dupont Jean -Bio-Informatique 116 Dupont Virginie -Biologie-------- 124 Dupont Marie +Informatique 112 Dupont Jean +Bio-Informatique 116 Dupont Virginie +Biologie 124 Dupont Marie Clermont-Ferrand 2 -Informatique---- 136 Simon Carine -Biologie-------- 154 Jean Claude +Informatique 136 Simon Carine +Biologie 154 Jean Claude Aurillac 2 -Biologie-------- 102 Michèle Robert -Bio-Informatique 98 Claude Loeb - -Limoges 0 +Biologie 102 Michèle Robert +Bio-Informatique 98 Claude Loeb Annecy 1 -Informatique---- 120 Duvillard André +Informatique 120 Duvillard André + +Lyon 3 +Informatique 170 Vincent Risk +Biologie 145 Virginie Mirid +Art-Plastique 50 Rodrigo Erwan + + diff --git a/part1.h b/part1.h index 8f553ec..9c36489 100644 --- a/part1.h +++ b/part1.h @@ -3,6 +3,9 @@ Dans cette partie nous allons implémenter un tableau de pointeurs dans lequel n Pour l'instant cela semble difficile mais nous allons diviser le travail de sorte à d'abord créer les structures requises, donc ici VilleIut et la liste. Nous ferons ensuite correspondre à ces structures, des données que nous pourrons insérer via des fonctions de type lireDep.. triées en fonction d'algorithmes de tris qui permettront plus tard une recherche simplifiée. Etant donné qu'il sera nécessaire de faire 2 parties (une partie administrateur et une partie utilisateur) nous allons en prendre une chacune : Roxane la partie utilisateur et Lola la partie administrateur.*/ + + + typedef struct list{ char departement[31];//le nom du département int nbP;//nombre de places @@ -41,6 +44,6 @@ void SaveEltList(FILE *fs, ListDept l);//sauvegarde un élément de liste int Admin(VilleIUT **tV, int nb);//partie admin de la première partie void AffnbPdpt ( MaillonDept *dpt );//Affiche nombre de place par département d'une liste void affichenbPIUT (VilleIUT *iut);//Affiche nombre de place restante d'un iut avec ses départements -void AffichenbPtableau(VilleIUT ** TabIUT, int n );//Affiche le tableau de places restantes des iuts avec leurs départements +void AffichenbPtableau(VilleIUT ** TIUT, int n );//Affiche le tableau de places restantes des iuts avec leurs départements int utilisateur (VilleIUT **tV, int nb);//Onglet accueille des utilisateurs void test (void); // fonction globale