L'affichage est enfin fixé pour la partie client, affichage claire et propre, et fonction de recherche pour la liste des départements marche

master
Nicolas BLONDEAU 2 years ago
parent 53899190e7
commit 5d47e90069

@ -5,68 +5,75 @@
void MenuUtilisateur(VilleIUT *tiut[], int n){
int choix, succes;
printf("\n1 - Recherche d'un IUT\n2 - Départements dans chaque IUT\n3 - Nombre de places en première année\n4 - Recherche d'un département\n5 - Quitter\n");
scanf("%d%*c",&choix);
if(choix==1){
//Recherche de tel IUT
succes = rechercheIUT(tiut, n);
}
if(choix==2){
succes = rechercheIUT(tiut, n);
if(succes==0
//creer departemement
/*printf("\ndepartement :");
scanf("%s",departement);
printf("\nnombre de place :");
scanf("%d",&nbp);
printf("\nresponsable :");
scanf("%s",respon);*/
//V=Enfiler(V,departement,nbp,respon);
}
if(choix==3){
//
}
if(choix==4){
//
}
if(choix==5){
return;
}
if(succes != 0){
//something
}
while(choix!=5){
printf("\n1 - Recherche d'un IUT\n2 - Départements dans chaque IUT\n3 - Nombre de places en première année\n4 - Recherche d'un département\n5 - Quitter\n");
scanf("%d%*c",&choix);
if(choix==1){
//Recherche de tel IUT
succes = rechercheIUT(tiut, n);
}
if(choix==2){
succes = rechercheDept(tiut, n);
//creer departemement
/*printf("\ndepartement :");
scanf("%s",departement);
printf("\nnombre de place :");
scanf("%d",&nbp);
printf("\nresponsable :");
scanf("%s",respon);*/
//V=Enfiler(V,departement,nbp,respon);
}
if(choix==3){
//
}
if(choix==4){
//
}
if(choix==5){
return;
}
/*
if(succes != 0){
//something
}*/
}
}
int rechercheIUT(VilleIUT *tiut[], int n){
char rech[31];
int i, trouve = 0;
printf("Entrez le nom d'une ville ou d'un IUT : ");
printf("\nEntrez le nom d'une ville ou d'un IUT : ");
scanf("%s", &rech);
for(i=0;i<n && trouve!=1;i++){
if(strcmp(tiut[i]->ville, rech)==0){
printf("Il y a un IUT à %s.\n", rech);
printf("\nIl y a un IUT à %s.\n", rech);
trouve = 1;
return 1;
}
else if(i==n-1)
printf("Il n'y pas d'IUT dans votre ville.");
printf("\nIl n'y pas d'IUT dans votre ville.\n");
}
return 0;
}
int rechercheDept(VilleIUT *tiut[], int n){
char rech[31];
int i, trouve = 0;
printf("Entrez le nom d'une ville ou d'un IUT : ");
int i, trouve = 0, j = 0;
ListeD ld = tiut[i]->ldept;
printf("\nEntrez le nom d'une ville ou d'un IUT : ");
scanf("%s", &rech);
for(i=0;i<n && trouve!=1;i++){
if(strcmp(tiut[i]->ville, rech)==0){
printf("Il y a un IUT à %s.\n\nListe des départements :\n", rech);
affichageListe(tiut[i]->ldept);
printf("\nListe des départements :\n\n");
while(ld!=NULL){
printf("%s\t",ld->departement);
printf("Responsable : %s\n",ld->resp);
ld = ld->suivant;
}
trouve = 1;
}
else if(i==n-1)
printf("Aucun département trouvé, il n'y pas d'IUT dans votre ville.");
printf("\nAucun département trouvé, il n'y pas d'IUT dans votre ville.\n");
}
return 0;
}

Loading…
Cancel
Save