SAE.c : Création de toute les fonctions utilisitateur (par encore testé et débugger) SAEl.c : modififcation de la fonction recherche pour la rendre compatible avec les structure

master
Alexis LAURENT 2 years ago
parent 33b54fb244
commit 98e0803a83

206
SAE.c

@ -39,13 +39,27 @@ bool verifQuit(void)
}
}
bool verifSelection(void)
{
char choix[4];
while(1)
{
printf("Voulez-vous continué la sélection (oui|non) : ");
scanf("%s",choix);
if (strcmp(choix,"oui")==0)
return true;
if (strcmp(choix,"non")==0)
return false;
}
}
int menuUtilisateurAffiche(void)
{
int choix;
printf("####################################################\n");
printf("\t\t|Menu Utilisateur|\n");
printf("\t\t------------------\n\n");
printf("1 - Consultation des IUT par ville\n");
printf("1 - Consultation des IUT\n");
printf("2 - Consultation des département global par IUT\n");
printf("3 - Consultation du nombre de places pour un Département par IUT\n");
printf("4 - Consultation du nombre de places pour un Département dans un IUT\n");
@ -66,7 +80,7 @@ int menuAdminAffiche(void)
printf("\t\tMenu Administrateur\n\n");
printf("1 - Mise à jour nombre de Places d'un Département d'un IUT\n");
printf("2 - Création d'un département dans un IUT\n");
printf("3 - Suppression d'u département dans un IUT\n");
printf("3 - Suppression d'un département dans un IUT\n");
printf("4 - Gestion des phases de candidature\n");
printf("5 - Changement d'un responsable de département\n");
printf("\n\n9 - Repasser en mode Utilisateur");
@ -165,10 +179,196 @@ void global(void)
gestionMenu();
}
void AffichageVille(VilleIUT **tiut, int nbEle)
{
int i;
printf("\tIUT par ville :");
for(i=0,i<nbEle;i = i + 1)
{
printf("- %s\n",tab[i]->ville);
}
}
void AffichageGlobalDepVille(VilleIUT **tiut, int nbEle)
{
int i;
printf("\tDépartement par IUT :\n");
for(i=0,i<nbEle;i = i + 1)
{
printf("- %s :\n\t",tiut[i]->ville);
while(tiut->idDept != NULL)
{
printf("|%s|\n",tiut->idDept->departement);
tiut->idDept = tiut->idDept->suiv;
}
}
}
void AffichageNbplaceDept(VilleIUT **tiut, int nbEle)
{
int pos;
for (pos = 0; pos < nbEle; pos++)
{
while(tiut[pos]->idDept->suiv != NULL && pos < nbEle)
{
printf("%s -> |%s, %d places|\n",tiut[pos]->ville,tiut[pos]->idDept->departement, tiut[pos]->idDept->nbPers);
tiut[pos]->idDept = tiut[pos]->idDept->suiv;
}
}
}
int rechVille(VilleIUT **tiut, int nbEle, char code[], int *trouve)
{
int i;
while(i<nbEle)
{
if (strcmp(code,tiut[i]->ville)==0)
*trouve = 1;
i = i + 1;
}
return i;
}
void AffichageNbplaceDeptVille(VilleIUT **tiut, int nbEle)
{
ListeDept *aux;
aux =(ListeDept *)malloc(sizeof(ListeDept));
char code[30];
int pos,trouve = 0;
while(1)
{
printf("IUT : ");
scanf("%s",code);
pos = rechVille(tiut, nbEle, code,&trouve);
aux = tiut[pos]->idDept;
if (trouve == 1)
{
while(1)
{
printf("Département : ");
scanf("%s",code);
trouve = 0;
while(aux->suiv != NULL)
{
if (strcmp(tiut[pos]->idDept->departement, code)==0)
{
printf("%s -> |%s, %d places|\n",tiut[pos]->ville,aux->departement, aux->nbPers);
trouve = 1;
break;
}
aux = aux->suiv;
}
if (trouve == 0)
printf("Département non présent à l'iut de %s",tiut[pos]->ville);
if(!verifSelection())
break;
aux = tiut[pos]->idDept;
}
}
else printf("Cette Ville n'as pas d'IUT (exit -> pour quitter)\n");
}
free(aux);
}
void AffichageGlobalDepVille(VilleIUT **tiut, int nbEle)
{
char code[30];
int pos,trouve = 0;
while(1)
{
printf("IUT : ");
scanf("%s",code);
pos = rechVille(tiut, nbEle, code,&trouve);
aux = tiut[pos]->idDept;
if (trouve == 1)
{
printf("%s :\n\t",tiut[pos]->ville);
affichageListeDept(tiut[pos]->idDept);
}
if (trouve == 0)
printf("Département non présent à l'iut de %s",tiut[pos]->ville);
if(!verifSelection())
break;
}
free(aux)
}
void AffichageDeptVille(VilleIUT **tiut, int nbEle)
{
ListeDept *aux;
aux =(ListeDept *)malloc(sizeof(ListeDept));
char code[30];
int pos, nbocc = 0;
while(1)
{
printf("IUT : ");
scanf("%s",code);
aux = tiut[pos]->idDept;
printf("\nIUT ayant un département %s : \n",code);
for(pos = 0; pos < nbEle; pos++)
{
if(strcmp(aux->departement, code)==0)
{
affichageListeDept(aux)
nbocc = nbocc + 1;
}
}
if (nbocc == 0)
printf("aucun département %s est présent en France\n", code);
if(!verifSelection())
break;
}
}
void MiseAJourNbPlace(VilleIUT **tiut, int nbEle)
{
ListeDept *aux;
aux =(ListeDept *)malloc(sizeof(ListeDept));
int nouvNbPlace, pos, trouve;
char code[30];
while(1)
{
printf("IUT : ");
scanf("%s",code);
pos = rechVille(tiut, nbEle, code,&trouve);
aux = tiut[pos]->idDept;
if (trouve == 1)
{
while(1)
{
printf("Département : ");
scanf("%s",code);
while(tiut[pos]->idDept->suiv != NULL)
{
if (strcmp(tiut[pos]->idDept->departement, code)==0)
{
printf("Ancien nombre de places : %d",tiut[pos]->idDept->nbPers);
printf("Nouveau nombre de places : ", nouvNbPlace);
scanf("%d", &nouvNbPlace)
tiut[pos]->idDept->nbPers = nouvNbPlace
printf("Mise à jour effectuer avec succès !");
break;
}
tiut[pos]->idDept = tiut[pos]->idDept->suiv;
}
if (trouve == 0)
printf("Département non présent à l'iut de %s",tiut[pos]->ville);
if(!verifSelection())
break;
tiut[pos]->idDept = aux;
}
}
}
}
void clearpage(void)
{
char entre;
printf("\nappuyé sur la touche [ENTREE] pour continuer");
scanf("%*c%c", &entre);
system("clear");
}
}

@ -181,13 +181,11 @@ ListeDept inserer(ListeDept l, char *dept, char *nom, int nbP)
// return cpt;
// }
// bool recherche(ListeDept l, int x)
// bool recherche(ListeDept l, char code[], int *pos)
// {
// if (l == NULL)
// return false;
// if (x < l->v)
// return false;
// if (x == l->v)
// if (strcmp(l->departement, code)==0)
// return true;
// return recherche(l->suiv, x);
// }

Loading…
Cancel
Save