|
|
|
@ -11,12 +11,10 @@ Choix lirechx (void){//Fonction qui va lire les choix de la ville et du departem
|
|
|
|
|
Choix chx;
|
|
|
|
|
|
|
|
|
|
printf("Saisir le choix de la ville \n");
|
|
|
|
|
fgets(chx.ville, 20, stdin);
|
|
|
|
|
chx.ville[strlen(chx.ville)-1]= '\0';
|
|
|
|
|
scanf( "%s", chx.ville);
|
|
|
|
|
|
|
|
|
|
printf("Saisir le choix du departement d'étude\n");
|
|
|
|
|
fgets(chx.dptmt, 20, stdin);
|
|
|
|
|
chx.dptmt[strlen(chx.dptmt)-1]= '\0';
|
|
|
|
|
scanf("%s" , chx.dptmt);
|
|
|
|
|
|
|
|
|
|
chx.dec = 0;
|
|
|
|
|
chx.valid = 0;
|
|
|
|
@ -91,6 +89,7 @@ Listechx InsertTC(Listechx list, Choix m)//Insert en tête de la liste
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Listechx InsertC(Listechx list, Choix m)//insert globalement dans liste de choix
|
|
|
|
|
{
|
|
|
|
|
if (list == NULL){return InsertTC(list, m);}
|
|
|
|
@ -149,6 +148,23 @@ Listecand recherchenum (Listecand l, int num){
|
|
|
|
|
return recherchenum (l->suivcand, num );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Listechx recherchechx (Listechx l, char *nom )//recherche du nom de département dans la liste
|
|
|
|
|
{
|
|
|
|
|
if ( l == NULL ){ return l;}
|
|
|
|
|
if ( strcmp ( l->chx.dptmt, nom ) == 0) return l;
|
|
|
|
|
return recherchechx (l->suivchx, nom );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Listechx majchoix (Listechx chx, Choix c){//Mise à jour du de la liste choix en modifiant un maillon
|
|
|
|
|
|
|
|
|
|
strcpy(chx->chx.ville, c.ville);
|
|
|
|
|
strcpy (chx->chx.dptmt, c.dptmt);
|
|
|
|
|
chx->chx.dec = c.dec;
|
|
|
|
|
chx->chx.valid = c.valid;
|
|
|
|
|
|
|
|
|
|
return chx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Listecand InsertT(Listecand list, Candidat c)//Insert en tête de la liste
|
|
|
|
|
{
|
|
|
|
|
Mailloncand *c1;
|
|
|
|
@ -206,25 +222,19 @@ Listecand Chargementlistecandidat(FILE *fe, Listecand lC, int *nbC)// fonction d
|
|
|
|
|
return lC;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Listechx suppressionchxT (Listechx l){//Fonction suppression d'un maillon
|
|
|
|
|
Listechx tmp;
|
|
|
|
|
tmp = l->suivchx;
|
|
|
|
|
free(l);
|
|
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void testchgt(void)
|
|
|
|
|
{
|
|
|
|
|
int nbC = 0;
|
|
|
|
|
Listecand lC=NULL;
|
|
|
|
|
FILE *fe;
|
|
|
|
|
printf("avantouverture\n");
|
|
|
|
|
fe=fopen("part2.don", "r");
|
|
|
|
|
if (fe == NULL){printf("pb ouv file"); return;}
|
|
|
|
|
printf("apres ouverture\n");
|
|
|
|
|
|
|
|
|
|
lC = Chargementlistecandidat(fe, lC, &nbC);
|
|
|
|
|
printf("apres chargement\n");
|
|
|
|
|
|
|
|
|
|
AffListeCandidat(lC);
|
|
|
|
|
printf("apres affichage\n");
|
|
|
|
|
|
|
|
|
|
Save(lC, nbC);
|
|
|
|
|
Listechx suppressionchx(Listechx l , char *depart){//suppression d'un maillon viale nom de son departement
|
|
|
|
|
if ( l == NULL) return l;
|
|
|
|
|
if ( strcmp ( depart, l->chx.dptmt ) == 0 )
|
|
|
|
|
return suppressionchxT(l);
|
|
|
|
|
l->suivchx = suppressionchx( l->suivchx , depart);
|
|
|
|
|
return l;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -268,14 +278,19 @@ void saveChx(Listechx lCh, FILE *fs)
|
|
|
|
|
|
|
|
|
|
void test (void){
|
|
|
|
|
|
|
|
|
|
int menu1, menugest1, numet,modifcand;
|
|
|
|
|
char nomet[20];
|
|
|
|
|
int menu1, menugest1, numet,modifcand, cont = 0, nbC;
|
|
|
|
|
char nomet[20], nomdpt[20], nomville[20];
|
|
|
|
|
Candidat cand1;
|
|
|
|
|
Choix choix1;
|
|
|
|
|
Listecand lcand, l2cand;
|
|
|
|
|
Listechx chx;
|
|
|
|
|
FILE *fe;
|
|
|
|
|
|
|
|
|
|
fe = fopen ("part2.don", "r");
|
|
|
|
|
if ( fe == NULL ){printf("prob ouverture fichier\n"); return;}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lcand = Chargementlistecandidat(fe, lcand, &nbC);
|
|
|
|
|
|
|
|
|
|
printf("Menu :\n");//Premier affichage menu pour choisir si on veut afficher le menu d'un candidat ou toutes les candidatures
|
|
|
|
|
printf("(1) Gestion Candidature\n(2) Affichage Candidature\n");
|
|
|
|
@ -307,19 +322,51 @@ void test (void){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else if (menugest1 == 2){//
|
|
|
|
|
printf("Entrer le numéro de candidat\n");
|
|
|
|
|
scanf("%d",&modifcand );
|
|
|
|
|
printf("Veuillez renseigner votre nom d'étudiant\n");
|
|
|
|
|
scanf("%s", nomet);
|
|
|
|
|
l2cand = recherchenom ( lcand, nomet );
|
|
|
|
|
|
|
|
|
|
printf("Entrer le nom du departement de l candidature concernée\n");
|
|
|
|
|
scanf("%s", nomdpt);
|
|
|
|
|
//PROBLEME SUR L'ASSIGNATION DU RESULTAT DE RECHERCHE... J'ARRIVE PAS
|
|
|
|
|
l2cand->cand.lchx = recherchechx(l2cand->cand.lchx, nomdpt);
|
|
|
|
|
while ( l2cand->cand.lchx->chx.dptmt == NULL){
|
|
|
|
|
printf("departement inconnu veuillez saisir à nouveau\n");
|
|
|
|
|
scanf("%s", nomdpt);
|
|
|
|
|
l2cand->cand.lchx = recherchechx(l2cand->cand.lchx , nomdpt);
|
|
|
|
|
}
|
|
|
|
|
choix1 = lirechx();
|
|
|
|
|
|
|
|
|
|
//FONCTION MISE A JOUR LISTE AVEC AFFICHAGE NOUVELLE LISTE
|
|
|
|
|
l2cand->cand.lchx = majchoix(l2cand->cand.lchx, choix1);
|
|
|
|
|
AffListeCandidat(l2cand);
|
|
|
|
|
}
|
|
|
|
|
//else if (menugest1 == 3)
|
|
|
|
|
//FONCTION SUPPRESSION LISTE AVEC AFFICHAGE NOUVELLE LISTE
|
|
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
//else if (menu1 == 2){
|
|
|
|
|
printf("");
|
|
|
|
|
|
|
|
|
|
else if (menugest1 == 3){
|
|
|
|
|
printf("Veuillez renseigner votre nom d'étudiant\n");
|
|
|
|
|
scanf("%s", nomet);
|
|
|
|
|
l2cand = recherchenom ( lcand, nomet );
|
|
|
|
|
|
|
|
|
|
printf("Entrer le nom du departement que vous souhaitez supprimer\n");
|
|
|
|
|
scanf ("%s", nomdpt);
|
|
|
|
|
l2cand->cand.lchx = suppressionchx(l2cand->cand.lchx , nomdpt );
|
|
|
|
|
printf("Voici votre nouvelle liste de candidature\n");
|
|
|
|
|
AffListeCandidat(l2cand);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if (menu1 == 2){
|
|
|
|
|
printf("Entrer le nom du departement dont vous souhaitez afficher les candidats");
|
|
|
|
|
scanf("%s", nomdpt);
|
|
|
|
|
|
|
|
|
|
printf("Entrer le nom de la ville dans laquelle se trouve le departement en question\n");
|
|
|
|
|
scanf("%s", nomville);
|
|
|
|
|
|
|
|
|
|
//FAIRE UNE FONCTION DE RECHERCHE RECURSIVE
|
|
|
|
|
/*FONCTION AFFICHE (CANDIDATS , VILLE, DEPARTEMENT)
|
|
|
|
|
EX : SI L->CHX.VILLE == VILLE && L->CHX.DEPARTEMENT == DEPARTEMENT
|
|
|
|
|
ALORS AFFICHE MAILLON CANDIDAT
|
|
|
|
|
RETURN AFFICHE CANDIDAT->SUIVANT, VILLE, DEPARTEMENT)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|