|
|
@ -199,14 +199,33 @@ int gestionMenuAdmin(VilleIUT **tiut, int nbEle)
|
|
|
|
|
|
|
|
|
|
|
|
void global(void)
|
|
|
|
void global(void)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int tailleL, i;
|
|
|
|
/*int tailleL, i;
|
|
|
|
VilleIUT** tab;
|
|
|
|
VilleIUT** tab;
|
|
|
|
char nomFich[20];
|
|
|
|
char nomFich[20];
|
|
|
|
strcpy(nomFich,"iut.txt");
|
|
|
|
strcpy(nomFich,"iut.txt");
|
|
|
|
printf("charg\n");
|
|
|
|
printf("charg\n");
|
|
|
|
tab = chargementVille(nomFich,30,&tailleL);
|
|
|
|
tab = chargementVille(nomFich,30,&tailleL);
|
|
|
|
printf("\n");
|
|
|
|
printf("\n");
|
|
|
|
gestionMenu(tab, tailleL);
|
|
|
|
gestionMenu(tab, tailleL);*/
|
|
|
|
|
|
|
|
int tailleL, i = 0;
|
|
|
|
|
|
|
|
Candidat** tab;
|
|
|
|
|
|
|
|
char nomFich[20];
|
|
|
|
|
|
|
|
strcpy(nomFich,"candidature.txt");
|
|
|
|
|
|
|
|
printf("charg\n");
|
|
|
|
|
|
|
|
tab = chargmentCandid(nomFich, 30, &tailleL);
|
|
|
|
|
|
|
|
printf("\n");
|
|
|
|
|
|
|
|
while(i < 4)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("%d %s %s\t",tab[i]->id, tab[i]->idCandIUT->iutCandid, tab[i]->idCandIUT->idCandDept->departement);
|
|
|
|
|
|
|
|
i = i + 1;
|
|
|
|
|
|
|
|
printf("\n");
|
|
|
|
|
|
|
|
afficherCandid(tab[i]->idCandIUT);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//tab[0]->idCandIUT = tab[0]->idCandIUT->suiv;
|
|
|
|
|
|
|
|
//printf("%s\n", tab[0]->idCandIUT->iutCandid);
|
|
|
|
|
|
|
|
tab[0]->idCandIUT->idCandDept = tab[0]->idCandIUT->idCandDept->suiv;
|
|
|
|
|
|
|
|
printf("%s\n", tab[0]->idCandIUT->idCandDept->departement);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void AffichageVille(VilleIUT **tiut, int nbEle)
|
|
|
|
void AffichageVille(VilleIUT **tiut, int nbEle)
|
|
|
@ -390,7 +409,7 @@ void MiseAJourNbPlace(VilleIUT **tiut, int nbEle)
|
|
|
|
if (aux != NULL)
|
|
|
|
if (aux != NULL)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
printf("Ancien nombre de places : %d\n",aux->nbPers);
|
|
|
|
printf("Ancien nombre de places : %d\n",aux->nbPers);
|
|
|
|
printf("Nouveau nombre de places : ", nouvNbPlace);
|
|
|
|
printf("Nouveau nombre de places : ");
|
|
|
|
scanf("%d", &nouvNbPlace);
|
|
|
|
scanf("%d", &nouvNbPlace);
|
|
|
|
aux->nbPers = nouvNbPlace;
|
|
|
|
aux->nbPers = nouvNbPlace;
|
|
|
|
printf("Mise à jour effectuer avec succès !");
|
|
|
|
printf("Mise à jour effectuer avec succès !");
|
|
|
@ -460,7 +479,7 @@ void suppressionDept(VilleIUT **tiut, int nbEle)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MaillonDept *aux;
|
|
|
|
MaillonDept *aux;
|
|
|
|
char code[30];
|
|
|
|
char code[30];
|
|
|
|
int trouve, pos, nbP;
|
|
|
|
int trouve, pos;
|
|
|
|
while(1)
|
|
|
|
while(1)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
printf("Dans quel IUT voulez-vous supprimer un département : ");
|
|
|
|
printf("Dans quel IUT voulez-vous supprimer un département : ");
|
|
|
@ -493,7 +512,7 @@ void modifChefDept(VilleIUT **tiut, int nbEle)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MaillonDept *aux;
|
|
|
|
MaillonDept *aux;
|
|
|
|
char code[30];
|
|
|
|
char code[30];
|
|
|
|
int trouve, pos, nbP;
|
|
|
|
int trouve, pos;
|
|
|
|
while(1)
|
|
|
|
while(1)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
printf("Dans quel IUT voulez-vous modifier le chef de département : ");
|
|
|
|
printf("Dans quel IUT voulez-vous modifier le chef de département : ");
|
|
|
@ -610,7 +629,7 @@ ListeCandidDept ListeCandidDeptvide(void)
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ListeCandidDept insererEnTeteCandidDept(ListeCandidDept l, char departement[], char deciDept[], int deciCandid)
|
|
|
|
ListeCandidDept insererEnTeteCandidDept(ListeCandidDept l, char departement[], int deciDept, int deciCandid)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MaillonCandidDept *m;
|
|
|
|
MaillonCandidDept *m;
|
|
|
|
m = (MaillonCandidDept *)malloc(sizeof(MaillonCandidDept));
|
|
|
|
m = (MaillonCandidDept *)malloc(sizeof(MaillonCandidDept));
|
|
|
@ -621,7 +640,7 @@ ListeCandidDept insererEnTeteCandidDept(ListeCandidDept l, char departement[], c
|
|
|
|
}
|
|
|
|
}
|
|
|
|
strcpy(m->departement, departement);
|
|
|
|
strcpy(m->departement, departement);
|
|
|
|
m->decisionDept = deciDept;
|
|
|
|
m->decisionDept = deciDept;
|
|
|
|
m->deciCandid = deciCandid;
|
|
|
|
m->decisionCandid = deciCandid;
|
|
|
|
m->suiv = l;
|
|
|
|
m->suiv = l;
|
|
|
|
return m;
|
|
|
|
return m;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -648,7 +667,7 @@ ListeCandid insererEnTeteCandid(ListeCandid l, char *ville)
|
|
|
|
printf("Pb maillon");
|
|
|
|
printf("Pb maillon");
|
|
|
|
exit(1);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
strcpy(ville, l->iutcandid);
|
|
|
|
strcpy(m->iutCandid, ville);
|
|
|
|
m->suiv = l;
|
|
|
|
m->suiv = l;
|
|
|
|
return m;
|
|
|
|
return m;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -657,9 +676,9 @@ ListeCandid insererCandid(ListeCandid l, char *ville)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (l == NULL)
|
|
|
|
if (l == NULL)
|
|
|
|
return insererEnTeteCandid(l, ville);
|
|
|
|
return insererEnTeteCandid(l, ville);
|
|
|
|
if (strcmp(ville, l->iutcandid) < 0)
|
|
|
|
if (strcmp(ville, l->iutCandid) < 0)
|
|
|
|
return insererEnTeteCandid(l, ville);
|
|
|
|
return insererEnTeteCandid(l, ville);
|
|
|
|
if (strcmp(ville, l->iutcandid) == 0)
|
|
|
|
if (strcmp(ville, l->iutCandid) == 0)
|
|
|
|
return l;
|
|
|
|
return l;
|
|
|
|
l->suiv = insererCandid(l->suiv, ville);
|
|
|
|
l->suiv = insererCandid(l->suiv, ville);
|
|
|
|
return l;
|
|
|
|
return l;
|
|
|
@ -709,9 +728,10 @@ ListeCandid suppressionCandid(ListeCandid l, char *ville)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (l == NULL)
|
|
|
|
if (l == NULL)
|
|
|
|
return l;
|
|
|
|
return l;
|
|
|
|
if (strcmp(ville, l->iutcandid) < 0)
|
|
|
|
if (strcmp(ville, l->iutCandid) < 0)
|
|
|
|
return l;
|
|
|
|
return l;
|
|
|
|
if (strcmp(ville, l->iutcandid) == 0)
|
|
|
|
if (strcmp(ville, l->iutCandid) == 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
while (1)
|
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (l->idCandDept == NULL)
|
|
|
|
if (l->idCandDept == NULL)
|
|
|
@ -719,7 +739,8 @@ ListeCandid suppressionCandid(ListeCandid l, char *ville)
|
|
|
|
suppressionEnTeteCandidDept(l->idCandDept);
|
|
|
|
suppressionEnTeteCandidDept(l->idCandDept);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return suppressionEnTeteCandid(l);
|
|
|
|
return suppressionEnTeteCandid(l);
|
|
|
|
l->suiv = suppressionCandid(l->suiv);
|
|
|
|
}
|
|
|
|
|
|
|
|
l->suiv = suppressionCandid(l->suiv, ville);
|
|
|
|
return l;
|
|
|
|
return l;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -741,7 +762,7 @@ void afficherCandid(ListeCandid l)
|
|
|
|
aux = l;
|
|
|
|
aux = l;
|
|
|
|
while(aux != NULL)
|
|
|
|
while(aux != NULL)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
printf("%s\t",aux->iutcandid);
|
|
|
|
printf("%s\t",aux->iutCandid);
|
|
|
|
afficherCandidDept(aux->idCandDept);
|
|
|
|
afficherCandidDept(aux->idCandDept);
|
|
|
|
aux = aux->suiv;
|
|
|
|
aux = aux->suiv;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -757,11 +778,11 @@ int longueur(ListeCandid l)
|
|
|
|
|
|
|
|
|
|
|
|
Candidat **chargmentCandid(char *nomFich, int tphys, int *tailleL)
|
|
|
|
Candidat **chargmentCandid(char *nomFich, int tphys, int *tailleL)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int i = 0, nbCandidat, nbCandid;
|
|
|
|
int i = 0, j = 0, nbCandidat, nbIUT, nbDept;
|
|
|
|
FILE *flot;
|
|
|
|
FILE *flot;
|
|
|
|
Candidat **tcandid;
|
|
|
|
Candidat **tcandid;
|
|
|
|
tcandid = (Candidat *)malloc(sizeof(Candidat) * tphys);
|
|
|
|
tcandid = (Candidat **)malloc(sizeof(Candidat *) * tphys);
|
|
|
|
if (tabV == NULL)
|
|
|
|
if (tcandid == NULL)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
printf("Erreur malloc tcandid !\n");
|
|
|
|
printf("Erreur malloc tcandid !\n");
|
|
|
|
exit(1);
|
|
|
|
exit(1);
|
|
|
@ -780,21 +801,51 @@ Candidat **chargmentCandid(char *nomFich, int tphys, int *tailleL)
|
|
|
|
fclose(flot);
|
|
|
|
fclose(flot);
|
|
|
|
exit(1);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fscanf(flot,"%d",&nbCandidat);
|
|
|
|
*(tcandid[*tailleL]) = lireCandidat(flot);
|
|
|
|
*(tcandid[*tailleL]) = lireCandidat(flot);
|
|
|
|
while(!feof(flot))
|
|
|
|
while(!feof(flot))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
fscanf(flot, "%d", &nbIUT);
|
|
|
|
|
|
|
|
tcandid[*tailleL]->idCandIUT = ListeCandidvide();
|
|
|
|
|
|
|
|
while(i < nbIUT)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
tcandid[*tailleL]->idCandIUT = traiterCandidIUT(tcandid[*tailleL]->idCandIUT, flot);
|
|
|
|
|
|
|
|
fscanf(flot, "%d", &nbDept);
|
|
|
|
|
|
|
|
tcandid[*tailleL]->idCandIUT->idCandDept = ListeCandidDeptvide();
|
|
|
|
|
|
|
|
while(j < nbDept)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
tcandid[*tailleL]->idCandIUT->idCandDept = traiterCandidDept(tcandid[*tailleL]->idCandIUT->idCandDept, flot);
|
|
|
|
|
|
|
|
j = j + 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
j = 0;
|
|
|
|
|
|
|
|
i = i + 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
|
|
|
|
*tailleL = *tailleL + 1;
|
|
|
|
|
|
|
|
tcandid[*tailleL] = (Candidat *)malloc(sizeof(Candidat));
|
|
|
|
|
|
|
|
if (tcandid[*tailleL] == NULL)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("Erreur malloc candidat !\n");
|
|
|
|
|
|
|
|
fclose(flot);
|
|
|
|
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
*(tcandid[*tailleL]) = lireCandidat(flot);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (tailleL == 0)
|
|
|
|
|
|
|
|
printf("Fichier vide !\n");
|
|
|
|
|
|
|
|
fclose(flot);
|
|
|
|
|
|
|
|
return tcandid;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Candidat lireCandidat(FILE *flot)
|
|
|
|
Candidat lireCandidat(FILE *flot)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Candidat c;
|
|
|
|
Candidat c;
|
|
|
|
fscanf(flot,"%a",&c.id);
|
|
|
|
fscanf(flot,"%d",&c.id);
|
|
|
|
fscanf(flot,"%s",c.nom);
|
|
|
|
fscanf(flot,"%s%*c",c.nom);
|
|
|
|
fgets(c.prenom,30,flot);
|
|
|
|
fgets(c.prenom,30,flot);
|
|
|
|
c.prenom[strlen(c.prenom) - 1] = '\0';
|
|
|
|
c.prenom[strlen(c.prenom) - 1] = '\0';
|
|
|
|
fscanf(flot,"%d %d %d %d", c.note[0], c.note[1], c.note[2], c.note[3]);
|
|
|
|
fscanf(flot,"%f %f %f %f", &c.note[0], &c.note[1], &c.note[2], &c.note[3]);
|
|
|
|
|
|
|
|
printf("%d %s %s %f %f %f %f\n",c.id, c.nom, c.prenom,c.note[0], c.note[1], c.note[2], c.note[3] );
|
|
|
|
return c;
|
|
|
|
return c;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -803,6 +854,7 @@ ListeCandid traiterCandidIUT(ListeCandid l, FILE *flot)
|
|
|
|
char ville[30];
|
|
|
|
char ville[30];
|
|
|
|
fscanf(flot,"%s",ville);
|
|
|
|
fscanf(flot,"%s",ville);
|
|
|
|
l = insererCandid(l , ville);
|
|
|
|
l = insererCandid(l , ville);
|
|
|
|
|
|
|
|
printf("\n %s \n",l->iutCandid);
|
|
|
|
return l;
|
|
|
|
return l;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -810,9 +862,8 @@ ListeCandidDept traiterCandidDept(ListeCandidDept l, FILE *flot)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
char departement[30];
|
|
|
|
char departement[30];
|
|
|
|
int deciDept, deciCandid;
|
|
|
|
int deciDept, deciCandid;
|
|
|
|
fscanf(flot,"%s",departement);
|
|
|
|
fscanf(flot,"%s %d %d",departement, &deciDept, &deciCandid);
|
|
|
|
fscanf(flot,"%d",deciDept);
|
|
|
|
l = insererCandidDept(l, departement, deciDept, deciCandid);
|
|
|
|
fscanf(flot,"%d",deciCandid);
|
|
|
|
printf("\n %s %d %d \n", l->departement, l->decisionDept, l->decisionCandid);
|
|
|
|
l = insererCandidDept(l);
|
|
|
|
|
|
|
|
return l;
|
|
|
|
return l;
|
|
|
|
}
|
|
|
|
}
|