mise a jour de la partie 1 coté utilisateurs, et fonction globale

master
Roxane ROSSETTO 2 years ago
parent 8d8db7b229
commit 7c50fc7be4

@ -106,7 +106,7 @@ int Chargement(VilleIUT **tV, int tmax, char *nameFile)
void AfficheDpmt ( MaillonDept *dpt )//Affiche un département d'une liste void AfficheDpmt ( MaillonDept *dpt )//Affiche un département d'une liste
{ {
if ( dpt == NULL) return; if ( dpt == NULL) return;
printf("%s %d %s \n", dpt->departement, dpt->nbP, dpt->respAd); printf("%s \t%d \t%s \n", dpt->departement, dpt->nbP, dpt->respAd);
AfficheDpmt(dpt->suiv); AfficheDpmt(dpt->suiv);
} }
@ -114,7 +114,7 @@ void AfficheDpmt ( MaillonDept *dpt )//Affiche un département d'une liste
void afficheIUT (VilleIUT *iut)//Affiche un iut avec ses départements void afficheIUT (VilleIUT *iut)//Affiche un iut avec ses départements
{ {
printf ("%s \n", iut->ville); printf ("%s \t\n", iut->ville);
AfficheDpmt(iut->ldept); AfficheDpmt(iut->ldept);
} }
@ -124,10 +124,30 @@ void Affichetableau(VilleIUT ** TabIUT, int n )//Affiche le tableau des iuts ave
{ {
int i; int i;
for ( i = 0 ; i < n ; i++ ) for ( i = 0 ; i < n ; i++ )
afficheIUT(TabIUT[i]); if ( TabIUT[i]->nbDept > 0)
afficheIUT(TabIUT[i]);
} }
void AffnbPdpt ( MaillonDept *dpt )//Affiche nombre de place par département d'une liste
{
if ( dpt == NULL) return;
printf("%s \t%d \n", dpt->departement, dpt->nbP);
AfficheDpmt(dpt->suiv);
}
void affichenbPIUT (VilleIUT *iut)//Affiche nombre de place restante d'un iut avec ses départements
{
printf ("%s \n", iut->ville);
AffnbPdpt(iut->ldept);
}
void AffichenbPtableau(VilleIUT ** TabIUT, 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]);
}
@ -373,12 +393,13 @@ int Admin(VilleIUT **tV, int nb)
int reponse; int reponse;
printf("*****************************************************\n"); printf("*****************************************************\n");
printf("*---------------------Accueil-----------------------*\n"); printf("*------------------Adminitrateur--------------------*\n");
printf("*-----1-modifier nombre places d'un département-----*\n"); printf("*-----1-modifier nombre places d'un département-----*\n");
printf("*--------2-créer un département dans un IUT---------*\n"); printf("*--------2-créer un département dans un IUT---------*\n");
printf("*------3-supprimer un département dans un IUT-------*\n"); printf("*------3-supprimer un département dans un IUT-------*\n");
printf("*-----4-modifier le nom du chef de département------*\n"); printf("*-----4-modifier le nom du chef de département------*\n");
printf("*---------5-arrêter la phase de candidatures--------*\n"); printf("*---------5-arrêter la phase de candidatures--------*\n");
//printf("*--------------------6-Retour-----------------------*\n");
printf("*****************************************************\n"); printf("*****************************************************\n");
scanf("%d", &reponse); scanf("%d", &reponse);
printf("%d", reponse); printf("%d", reponse);
@ -389,5 +410,99 @@ int Admin(VilleIUT **tV, int nb)
case 3: deleteIUT(tV, nb); return 0; case 3: deleteIUT(tV, nb); return 0;
case 4: MaJnameC(tV, nb); return 0; case 4: MaJnameC(tV, nb); return 0;
case 5: Save(tV, nb); return 1; case 5: Save(tV, nb); return 1;
//case 6: exit(1);
} }
} }
int utilisateur (VilleIUT **tV, int nb){//Onglet accueille des utilisateurs
int reponse, i;
char rdpt[20];
MaillonDept * ldepart;
printf("*****************************************************\n");
printf("*-------------------Utilisateur---------------------*\n");
printf("*------1-Affichage de toutes les informations-------*\n");
printf("*-----2-Places restantes pour la première année-----*\n");
printf("*----------3-Recherche d'un departement-------------*\n");
printf("*--------------------4-Retour-----------------------*\n");
printf("*****************************************************\n");
scanf("%d", &reponse);
printf("%d", reponse);
while ( reponse == 1 || reponse == 2 || reponse == 3 || reponse == 4){
if ( reponse == 1 ){
Affichetableau(tV, nb);
return 0;
}
if ( reponse == 2){
AffichenbPtableau(tV, nb);
return 0;
}
if ( reponse == 3){
printf("Quel departement souhaitez vous integrer?\n");
scanf("%s", rdpt);
for ( i = 0 ; i < nb ; i++){
ldepart = recherche (tV[i]->ldept, rdpt);
AfficheDpmt(ldepart);
}
return 0;
}
if ( reponse == 4 )
return 2;
}
return 0 ;
}
void test (void){ // fonction globale
int acc, nb, nbville, repAdm, repVis;
VilleIUT *tV[200];
nbville = Chargement(tV, 200, "part1.don");
printf("*****************************************************\n");
printf("*---------------------Accueil-----------------------*\n");
printf("*-----------------1-Adminitrateur-------------------*\n");
printf("*-------------------2-Visiteur----------------------*\n");
printf("*-------------------3-Quitter-----------------------*\n");
printf("*****************************************************\n");
scanf("%d", &acc);
while ( acc == 1 || acc == 2){
if (acc == 1){
repAdm = Admin (tV, nbville);
}
if (acc == 2){
repVis = utilisateur (tV, nbville);
if (repVis == 2){
acc = 3;
}
}
if ( acc == 3 ){
Save( tV, nb );
exit;
}
return;
}
}
/* SOUCIS AVEC LA FONCTION TEST, JE N'ARRIVE PAS A SORTIR DU WHILE POUR RETOURNER AU MENU PRINCIPAL
ADMIN/ VISITEUR. FONCTION RECURCIVE?
FONCTION RECHERCHE DANS TEST NE RETURN RIEN
FONCTION AFFICHAGE nbP AFFICHE QUAND MEME LE NOM DES RESPONSABLE... MAIS PAS TOUS
JE PEUX Y REVENIR DEMAIN SUR MA PARTIE, PAR CONTRE SUR TA PARTIE JE CROIS QU'IL Y A DES ERREURS
DE SEGMENTATION HESITE PAS A FAIRE RE RUN LE TRUC
*/

@ -1,12 +1,18 @@
Grenoble 3 Grenoble 3
Informatique 112 Dupont Jean Informatique---- 112 Dupont Jean
Bio-Informatique 116 Dupont Virginie Bio-Informatique 116 Dupont Virginie
Biologie 124 Dupont Marie Biologie-------- 124 Dupont Marie
Clermont-Ferrand 2 Clermont-Ferrand 2
Informatique 136 Simon Carine Informatique---- 136 Simon Carine
Biologie 154 Jean Claude Biologie-------- 154 Jean Claude
Aurillac 2 Aurillac 2
Biologie 102 Michèle Robert Biologie-------- 102 Michèle Robert
Bio-Informatique 98 Claude Loeb Bio-Informatique 98 Claude Loeb
Limoges 0
Annecy 1
Informatique---- 120 Duvillard André

@ -39,3 +39,8 @@ void MaJnameC(VilleIUT **tV, int nb);//mise à jour du nom du chef de départeme
void Save(VilleIUT **tV, int nb);//sauvegarde le fichier void Save(VilleIUT **tV, int nb);//sauvegarde le fichier
void SaveEltList(FILE *fs, ListDept l);//sauvegarde un élément de liste 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 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
int utilisateur (VilleIUT **tV, int nb);//Onglet accueille des utilisateurs
void test (void); // fonction globale

@ -12,11 +12,6 @@ int main(void)
int nb, reponse; int nb, reponse;
VilleIUT *v; VilleIUT *v;
ListDept l; ListDept l;
nb = Chargement(tV, 200, "part1.don"); test ();
reponse = Admin(tV, nb);
printf("%d\n", reponse);
printf("\n\n\n");
Affichetableau(tV, nb);
return 0; return 0;
} }

Loading…
Cancel
Save