Ajout fonction "afficheDeptDesIUT"

master
Maël DAIM 2 years ago
parent b61a37b1a9
commit 35a092c8a7

@ -179,6 +179,27 @@ void afficherPlace(Departement d) /* Permet d'afficher le nombre de place dispon
printf("\nPour ce département il y a %d places en 1ère année \n\n",d.nbP); printf("\nPour ce département il y a %d places en 1ère année \n\n",d.nbP);
} }
void afficheDeptDesIUT(VilleIUT *tiut[], int tLog)
{
char dept[31];
int i,trouve;
system("clear");
printf("######################################################################################################################\n");
printf("Quel département cherchez-vous dans les IUT ?\t");
scanf("%s%*c",dept);
printf("\n\n\t\tCe département est présent dans ces IUT :\n");
printf("----------------------------------------------------------------------------------------------------\n");
for(i=0;i<tLog;i++)
{
rechercherDept(tiut[i]->lDept,dept,&trouve);
if (trouve==1)
{
printf("|%s",tiut[i]->nom);
}
}
printf("|\n");
clearpage();
}

@ -36,6 +36,7 @@ void afficherDep(Departement d);
void afficherVille(VilleIUT v); void afficherVille(VilleIUT v);
void afficherTIUT(VilleIUT *tiut[], int tLog); void afficherTIUT(VilleIUT *tiut[], int tLog);
void afficherVilleDep(VilleIUT v); void afficherVilleDep(VilleIUT v);
void afficheDeptDesIUT(VilleIUT *tiut[], int tLog);
/* Fonctions de Listes */ /* Fonctions de Listes */

176
Msae.c

@ -218,6 +218,30 @@ void afficherDep(Departement d)
printf("|----------------------------------------------------------------------------|\n"); printf("|----------------------------------------------------------------------------|\n");
} }
void afficheDeptDesIUT(VilleIUT *tiut[], int tLog)
{
char dept[31];
int i,trouve;
system("clear");
printf("######################################################################################################################\n");
printf("Quel département cherchez-vous dans les IUT ?\t");
scanf("%s%*c",dept);
printf("\n\n\t\tCe département est présent dans ces IUT :\n");
printf("----------------------------------------------------------------------------------------------------\n");
for(i=0;i<tLog;i++)
{
rechercherDept(tiut[i]->lDept,dept,&trouve);
if (trouve==1)
{
printf("|%s",tiut[i]->nom);
}
}
printf("|\n");
clearpage();
}
//################# fonctions recherche ######################### //################# fonctions recherche #########################
@ -415,3 +439,155 @@ void miseAJourGlobale(VilleIUT *tiut[], int tLog)
clearpage(); clearpage();
afficherDep(d); afficherDep(d);
} }
// ######################## fonction menus ##############################
// void menuAdmin(VilleIUT *tiut[], int *tLog, int tMax) /* Affiche un menu de choix adaptés pour un administrateur et appelle les fonctions en conséquence */
// {
// int select, pos;
// int trouve;
// char ville[31], choix;
// ListeDept l;
// printf("__________________________________________________________\n");
// printf("| MENU ADMIN |\n");
// printf("|--------------------------------------------------------|\n");
// printf("| 1 Afficher les villes possédant un IUT |\n");
// printf("| 2 Afficher les départements d'un IUT |\n");
// printf("| 3 Créer un nouveau département |\n");
// printf("| 4 Supprimer un département |\n");
// printf("| 5 Effectuer une mise à jour d'un département d'un IUT |\n");
// printf("| 6 Insérer un nouvel IUT |\n");
// printf("| 7 Supprimer un IUT de la liste |\n");
// printf("| 8 Lancer/Arrêter la phase de candidature |\n");
// printf("| 9 Quitter |\n");
// printf("|--------------------------------------------------------|\n\n");
// printf("Saisie : "); /* Choix de l'administrateur */
// scanf("%d%*c",&select);
// while(select != 9) /* Tant que l'utilisateur ne saisie pas 9, le menu réapparait après que la fonction appelée est terminée */
// {
// system("clear");
// if(select == 1)
// {
// afficherTIUT(tiut, *tLog);
// }
// if(select == 2)
// {
// printf("Pour quelle ville souhaitez-vous afficher les départements ?\nSaisie : "); /* Demande une ville à afficher */
// scanf("%s%*c", ville);
// printf("\n");
// pos = rechercheIUT(tiut, *tLog, ville, &trouve); /* Vérifie que la ville existe */
// while(trouve == 0) /* Si elle n'existe pas, on effectue une saisie contrôlée */
// {
// printf("Cette ville n'existe pas, veuillez re-sasisir : ");
// scanf("%s%*c", ville);
// pos = rechercheIUT(tiut, *tLog, ville , &trouve);
// printf("\n");
// }
// afficherVilleDep(*tiut[pos]); /* Affiche ensuite la ville */
// }
// if(select == 3)
// {
// creerDept(tiut, *tLog);
// }
// if(select == 4)
// {
// retirerDept(tiut, *tLog);
// }
// if(select == 5)
// {
// miseAJourGlobale(tiut, tLog);
// }
// if(select == 6)
// {
// printf("Quel est le nom de la ville à insérer ?\nSaisie : "); /* Demande le nom de la ville à insérer */
// scanf("%s%*c", ville);
// printf("\n");
// pos = rechercheIUT(tiut, *tLog, ville, &trouve); /* Vérifie que la ville existe */
// if(trouve == 1) /* Si elle existe, affiche un message d'erreur */
// {
// printf("Erreur, cette ville existe déjà !\n");
// }
// else /* Sinon, appelle la fonction d'insertion */
// {
// insererVille(tiut, ville, tLog, tMax, pos);
// }
// }
// if(select == 7)
// {
// printf("Quel est le nom de la ville à supprimer ?\nSaisie : "); /* Demande le nom de la ville à supprimer */
// scanf("%s%*c", ville);
// printf("\n");
// pos = rechercheIUT(tiut, *tLog, ville, &trouve); /* Vérifie qu'elle existe */
// if(trouve == 0) /* Si elle n'existe pas, affiche un message d'erreur */
// {
// printf("Erreur, cette ville n'existe pas !\n");
// }
// else /* Sinon, demande confirmation, si confirmé, supprime la ville, sinon annule la suppression */
// {
// printf("Êtes-vous sur de vouloir supprimer cette ville ? (O/n)\nSaisie : "); /* Demande confirmation de la suppression */
// scanf("%c%*c", &choix);
// printf("\n");
// if(choix == 'N' || choix == 'n') /* Si le choix et non, annule la supression */
// {
// printf("Suppression annulée\n");
// }
// else
// {
// supprimerVille(tiut, ville, tLog, pos);
// }
// }
// }
// printf("__________________________________________________________\n");
// printf("| MENU ADMIN |\n");
// printf("|--------------------------------------------------------|\n");
// printf("| 1 Afficher les villes possédant un IUT |\n");
// printf("| 2 Afficher les départements d'un IUT |\n");
// printf("| 3 Créer un nouveau département |\n");
// printf("| 4 Supprimer un département |\n");
// printf("| 5 Effectuer une mise à jour d'un département d'un IUT |\n");
// printf("| 6 Insérer un nouvel IUT |\n");
// printf("| 7 Supprimer un IUT de la liste |\n");
// printf("| 8 Lancer/Arrêter la phase de candidature |\n");
// printf("| 9 Quitter |\n");
// printf("|--------------------------------------------------------|\n\n");
// printf("Saisie : ");
// scanf("%d%*c",&select);
// }
// }
// ###################################################################### Globale ##################################################################################################################
// void globale(void)
// {
// int tLog, retour;
// VilleIUT *tiut[100];
// if(tiut == NULL)
// {
// printf("Problème d'allocation mémoire du tableau tiut\n");
// exit(1);
// }
// tLog = chargement(tiut,100);
// if(tLog < 0)
// {
// printf("Le programme ne peut pas fonctionner\n");
// exit(1);
// }
// retour = login();
// while(retour != -1)
// {
// if(retour == 1)
// {
// menuAdmin(tiut, &tLog, 100);
// }
// if(retour == 0)
// {
// menuCandidat(tiut, &tLog, 100);
// }
// retour = login();
// }
// }

@ -40,6 +40,7 @@ void afficherDep(Departement d);
void afficherVilleDep(VilleIUT v); void afficherVilleDep(VilleIUT v);
void afficherTIUT(VilleIUT *tiut[], int tLog); void afficherTIUT(VilleIUT *tiut[], int tLog);
void afficherVille(VilleIUT v); void afficherVille(VilleIUT v);
void afficheDeptDesIUT(VilleIUT *tiut[], int tLog);
//########## fonction de mise à jour ########### //########## fonction de mise à jour ###########
void miseAJourGlobale(VilleIUT *tiut[], int tLog); void miseAJourGlobale(VilleIUT *tiut[], int tLog);

@ -2,10 +2,14 @@
int main(void) int main(void)
{ {
VilleIUT *tiut[100];
int tLog; int tLog;
VilleIUT *tiut[50]; tLog = chargement(tiut,100);
tLog=chargement(tiut,50); if(tLog < 0)
afficherTIUT(tiut,tLog); {
miseAJourGlobale(tiut,tLog); printf("Le programme ne peut pas fonctionner\n");
exit(1);
}
afficheDeptDesIUT(tiut,tLog);
return 0; return 0;
} }

Loading…
Cancel
Save