|
|
|
@ -215,6 +215,8 @@ void global(void)
|
|
|
|
|
tab = chargmentCandid("candidature.txt", &tphys, &nb);
|
|
|
|
|
system("clear");
|
|
|
|
|
afficherCandid(tab, nb);
|
|
|
|
|
supprimerCandid(tab, &nb);
|
|
|
|
|
afficherCandid(tab, nb);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -844,9 +846,103 @@ ChoixDept *traiterCandidDept(int tailleL, int tailleP, FILE *flot)
|
|
|
|
|
return cD;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int rechCandid(Candidat **tab, int nbEle, int id, int *trouve)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
for (i=0; i < nbEle; i++)
|
|
|
|
|
{
|
|
|
|
|
if (tab[i]->id == id)
|
|
|
|
|
{
|
|
|
|
|
*trouve = 1;
|
|
|
|
|
return i;
|
|
|
|
|
}
|
|
|
|
|
if (tab[i]->id > id)
|
|
|
|
|
{
|
|
|
|
|
*trouve = 0;
|
|
|
|
|
return i;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void triEchangecandid(Candidat **tab, int nbEle)
|
|
|
|
|
{
|
|
|
|
|
int pge;
|
|
|
|
|
while(nbEle > 1)
|
|
|
|
|
{
|
|
|
|
|
pge = plusGrandCandid(tab, nbEle);
|
|
|
|
|
echangerCandid(tab, pge, nbEle - 1);
|
|
|
|
|
nbEle = nbEle - 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int plusGrandCandid(Candidat **tab, int nbEle)
|
|
|
|
|
{
|
|
|
|
|
int pge = 0, i;
|
|
|
|
|
for (i = 1; i < nbEle; i++)
|
|
|
|
|
{
|
|
|
|
|
if(tab[i]->id > tab[pge]->id)
|
|
|
|
|
pge = 1;
|
|
|
|
|
return pge;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void echangerCandid(Candidat **tab, int i, int j)
|
|
|
|
|
{
|
|
|
|
|
Candidat *aux;
|
|
|
|
|
aux = tab[i];
|
|
|
|
|
tab[i] = tab[j];
|
|
|
|
|
tab[j] = aux;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ListeCandid rechCandidIUT(ListeCandid l, char *code)
|
|
|
|
|
[
|
|
|
|
|
if (l == NULL)
|
|
|
|
|
return NULL;
|
|
|
|
|
if ((strcmp(code, l->iutCandid)) < 0)
|
|
|
|
|
return NULL;
|
|
|
|
|
if ((strcmp(code, l->iutCandid)) == 0)
|
|
|
|
|
return l;
|
|
|
|
|
return rechCandidIUT(l->suiv, code)
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
void supprimerCandid(Candidat **tab, int *nbEle)
|
|
|
|
|
{
|
|
|
|
|
int idSup;
|
|
|
|
|
int idSup, pos, trouve;
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
printf("Identifiant de la candidiature à supprimer : ");
|
|
|
|
|
scan
|
|
|
|
|
scanf("%d", &idSup);
|
|
|
|
|
pos = rechCandid(tab, *nbEle, idSup, &trouve);
|
|
|
|
|
if (trouve == 0)
|
|
|
|
|
{
|
|
|
|
|
printf("Candidature non présente dans la base de donnée\n");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (trouve == 1)
|
|
|
|
|
if (!confirmationSup())
|
|
|
|
|
return;
|
|
|
|
|
while(tab[pos]->idCandIUT != NULL)
|
|
|
|
|
{
|
|
|
|
|
suppressionCandid(tab[pos]->idCandIUT, tab[pos]->idCandIUT->iutCandid, tab[pos]->idCandIUT->tabDept, tab[pos]->idCandIUT->nbChoix);
|
|
|
|
|
tab[pos]->idCandIUT = tab[pos]->idCandIUT->suiv;
|
|
|
|
|
}
|
|
|
|
|
*nbEle = *nbEle - 1;
|
|
|
|
|
free(tab[pos]);
|
|
|
|
|
triEchangecandid(tab, *nbEle + 1);
|
|
|
|
|
|
|
|
|
|
if(!verifSelection())
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void créationCandid(Candidat **tab, int *nbEle, int tailleP)
|
|
|
|
|
{
|
|
|
|
|
char nom[30], prenom[30], dept[30], ville[30];
|
|
|
|
|
int idAdd, nbDept, deciCandid, deciDept;
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
idAdd = *nbEle;
|
|
|
|
|
printf("votre");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|