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.
103 lines
2.1 KiB
103 lines
2.1 KiB
#include"Ssae.h"
|
|
|
|
void menuAdmin(VilleIUT *tiut[], int *tLog, int tMax){
|
|
int select=0;
|
|
while(select!=9){
|
|
system("clear");
|
|
printf("\t AFFICHAGE ADMIN\n\n");
|
|
printf("1\tModifier le nombre de places dans un département\n");
|
|
printf("2\tCréer un nouveau département\n");
|
|
printf("3\tSupprimer un département\n");
|
|
printf("4\tLancer/Arrêter la phase de candidature\n");
|
|
printf("5\tModifer le nom du responsable d'un département\n");
|
|
scanf("%d",&select);
|
|
}
|
|
}
|
|
|
|
void menuCandidat(VilleIUT *tiut[], int *tLog, int tMax){
|
|
int select=0;
|
|
while(select!=9){
|
|
system("clear");
|
|
printf("\t AFFICHAGE CANDIDAT \n\n");
|
|
printf("1\tRechercher les villes où il y a un IUT\n");
|
|
printf("2\tRechercher chaque département dans les IUT\n");
|
|
printf("3\tNombres de places en 1A\n");
|
|
printf("4\tRechercher un département dans les IUT\n");
|
|
scanf("%d",&select);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void clearpage(void)
|
|
{
|
|
char entre;
|
|
printf("\nappuyé sur la touche [ENTREE] pour continuer");
|
|
scanf("%*c%c", &entre);
|
|
system("clear");
|
|
}
|
|
|
|
int chargement(VilleIUT *tiut[],int *tMax)
|
|
{
|
|
FILE *flot;
|
|
VilleIUT *v;
|
|
MaillonDept *m;
|
|
int nb = 0, pos;
|
|
char trouve;
|
|
flot = fopen("IUT.don", "r");
|
|
if(flot == NULL)
|
|
{
|
|
printf("Problème d'ouverture du fichier\n");
|
|
return -1;
|
|
}
|
|
while(!feof(flot))
|
|
{
|
|
v = (VilleIUT *)malloc(sizeof(VilleIUT));
|
|
if(v == NULL)
|
|
{
|
|
printf("Problème allocation ville lors de la lecture du fichier\n");
|
|
return -2;
|
|
}
|
|
fscanf(flot, "%s", v->nom);
|
|
pos = recherche(tiut, nb, v->nom, &trouve);
|
|
m = (MaillonDept *)malloc(sizeof(MaillonDept));
|
|
if(m == NULL)
|
|
{
|
|
printf("Problème allocation département lors de la lecture du fichier\n");
|
|
return -3;
|
|
}
|
|
*m = lireDep(flot);
|
|
if(trouve == 'O')
|
|
{
|
|
insererDep(tiut[pos],*m);
|
|
}
|
|
else
|
|
{
|
|
m->suiv = NULL;
|
|
v->lDept = m;
|
|
tiut[nb] = v;
|
|
}
|
|
free(v);
|
|
free(m);
|
|
nb++;
|
|
}
|
|
return nb;
|
|
}
|
|
|
|
int rechercheIUT(VilleIUT *tiut[], int tLog, char ville[], char *trouve){
|
|
int inf,sup,t;
|
|
inf=0;
|
|
sup=tLog-1;
|
|
while(inf<=sup){
|
|
t=(inf+sup)/2;
|
|
if(strcmp(ville,tiut[t]->nom)==0){
|
|
*trouve=1;
|
|
return t;
|
|
}
|
|
if(strcmp(ville,tiut[t]->nom)<0)
|
|
sup=t-1;
|
|
else inf=t+1;
|
|
}
|
|
|
|
}
|