You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

196 lines
4.4 KiB

#include "partie1.h"
void choixMenu(void)
{
int choix;
bool c = false;
while (c == false)
{
system("clear");
printf("Veuillez choisir votre menu :\n");
printf("\t1 - Menu utilisateur\n");
printf("\t2 - Menu administrateur\n");
printf("\t9 - Quitter\n");
printf("\nChoix : ");
scanf("%d", &choix);
switch (choix)
{
case 1:
c = true;
menuUtilisateur();
break;
case 2:
c = true;
menuAdministrateur();
break;
case 9:
c = true;
break;
default:
printf("Option non reconnue. Veuillez recommencer.\n");
break;
}
}
}
void menuUtilisateur(void)
{
int choix;
bool c = false;
while (c == false)
{
system("clear");
printf("Menu d'utilisateur : Que voulez-vous faire ?\n");
printf("\t1 - Voir les villes possédant un IUT\n");
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)
{
case 1:
c = true;
//
break;
case 2:
c = true;
//
break;
case 3:
c = true;
//
break;
case 4:
c = true;
//
break;
case 9:
c = true;
return choixMenu();
default:
printf("Option non reconnue. Veuillez recommencer.\n");
break;
}
}
}
void menuAdministrateur(void)
{
int choix;
bool c = false;
while (c == false)
{
system("clear");
printf("Menu d'administrateur : Que voulez-vous faire ?\n");
printf("\t1 - Modifier le nombre de places dans un département\n");
printf("\t2 - Créer un département dans un IUT\n");
printf("\t3 - Supprimer un département d'un IUT\n");
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)
{
case 1:
c = true;
//
break;
case 2:
c = true;
//
break;
case 3:
c = true;
//
break;
case 4:
c = true;
//
break;
case 5:
c = true;
//
break;
case 6:
c = true;
//
break;
case 9:
return choixMenu();
break;
default:
printf("Option non reconnue. Veuillez recommencer.\n");
break;
}
}
}
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);
}
}