Ajout de fonctions

master
Kyllian CHABANON 2 years ago
parent bcdd827481
commit 5ba89b5353

@ -45,6 +45,7 @@ void menuUtilisateur(void)
printf("\t2 - Voir les départements dans chaque IUT\n");
printf("\t3 - Voir le nombre de places en première année\n");
printf("\t4 - Voir les IUT possédant un département particulier\n");
printf("\t9 - Quitter\n");
printf("\nChoix : ");
scanf("%d", &choix);
switch (choix)
@ -67,7 +68,7 @@ void menuUtilisateur(void)
break;
case 9:
c = true;
break;
return choixMenu();
default:
printf("Option non reconnue. Veuillez recommencer.\n");
break;
@ -89,6 +90,7 @@ void menuAdministrateur(void)
printf("\t4 - Lancer la phase de candidature\n");
printf("\t5 - Stopper la phase de candidature\n");
printf("\t6 - Modifier le responsable d'un département\n");
printf("\t9 - Quitter\n");
printf("\nChoix : ");
scanf("%d", &choix);
switch (choix)
@ -118,7 +120,7 @@ void menuAdministrateur(void)
//
break;
case 9:
c = true;
return choixMenu();
break;
default:
printf("Option non reconnue. Veuillez recommencer.\n");
@ -126,3 +128,69 @@ void menuAdministrateur(void)
}
}
}
ListeDept listenouv(void)
{
return NULL;
}
ListeDept insererEnTete(ListeDept l, char departement[], int nbP)
{
MaillonDept *m;
m = (MaillonDept *)malloc(sizeof(MaillonDept));
if (m == NULL)
{
printf("Fonction insererEnTete : problème malloc");
exit(1);
}
strcpy(m->departement, departement);
m->nbP = nbP;
m->suiv = l;
return l;
}
ListeDept chargeListeDept(VilleIUT *tiut[])
{
int i = 0;
ListeDept liste = listenouv();
FILE *file = fopen("informationsIUT.don", "r");
while (!feof(file))
{
}
}
int chargementVilleIUT(VilleIUT *tiut[])
{
FILE *file = fopen("informationsIUT.don", "r");
VilleIUT villeiut;
char ville[30], dept[30], nomResp[30];
int nbP, i = 0;
if (file == NULL)
{
printf("Fonction chargementVilleIUT : Problème lors de l'ouverture du fichier informations.don");
exit(-1);
}
while (!feof(file))
{
tiut[i] = (VilleIUT *)malloc(sizeof(VilleIUT));
if (tiut[i] == NULL)
{
printf("erreur malloc");
exit(-1);
}
fscanf(file, "%s%s%d", tiut[i]->ville, dept, &nbP);
fgets(nomResp, 30, file);
i++;
}
fclose(file);
return i;
}
void affichage(VilleIUT *tiut[], int nb)
{
for (int i = 0; i < nb; i++)
{
printf("%s\n", tiut[i]->ville);
}
}

@ -3,6 +3,15 @@
#include "../structures/structures.h"
#include <stdbool.h>
/* Menus */
void choixMenu(void);
void menuUtilisateur(void);
void menuAdministrateur(void);
/* Fichier */
int chargementVilleIUT(VilleIUT *tiut[]);
void affichage(VilleIUT *tiut[], int nb);
/* File */
ListeDept listenouv(void);

@ -2,6 +2,8 @@
int main(void)
{
choixMenu();
VilleIUT *tiut[100];
int nb = chargementVilleIUT(tiut);
affichage(tiut, nb);
return 0;
}

Loading…
Cancel
Save