|
|
|
@ -1,10 +1,10 @@
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include "commun.h"
|
|
|
|
|
#include "part2.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
##########################TABLEAU POINTEUR#####################################################
|
|
|
|
|
//##########################TABLEAU POINTEUR#####################################################
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Choix lirechx (void){//Fonction qui va lire les choix de la ville et du departement demandé par le candidat
|
|
|
|
@ -28,8 +28,6 @@ Choix lirechx (void){//Fonction qui va lire les choix de la ville et du departem
|
|
|
|
|
Candidat lireCandidat(void)//fonction qui lit un candidat sur le clavier
|
|
|
|
|
{
|
|
|
|
|
Candidat c;
|
|
|
|
|
printf("Numéro de candidat :\n");
|
|
|
|
|
scanf("%d%*c", &c.nEtu);
|
|
|
|
|
printf("Nom du candidat :\n");
|
|
|
|
|
fgets(c.nom, 20, stdin);
|
|
|
|
|
c.nom[strlen(c.nom)-1]= '\0';
|
|
|
|
@ -73,39 +71,63 @@ Candidat lireFich1Cand (FILE * fe){
|
|
|
|
|
Candidat cand;
|
|
|
|
|
|
|
|
|
|
fgets(cand.nom, 20, fe);
|
|
|
|
|
c.nom[strlen(c.nom)-1]= '\0';
|
|
|
|
|
cand.nom[strlen(cand.nom)-1]= '\0';
|
|
|
|
|
|
|
|
|
|
fgets(cand.prenom, 20, fe);
|
|
|
|
|
cand.prenom[strlen(cand.prenom)-1]= '\0';
|
|
|
|
|
|
|
|
|
|
fgets(c.prenom, 20, fe);
|
|
|
|
|
c.prenom[strlen(cand.prenom)-1]= '\0';
|
|
|
|
|
fscanf(fe, "%f", &cand.moymat);
|
|
|
|
|
fscanf(fe, "%f", &cand.moyfr);
|
|
|
|
|
fscanf(fe, "%f", &cand.moyen);
|
|
|
|
|
fscanf(fe, "%f", &cand.moyspe);
|
|
|
|
|
fscanf(fe, "%d%*c", &cand.nbchx);
|
|
|
|
|
|
|
|
|
|
fscanf(fe, "%f", &c.moymat);
|
|
|
|
|
fscanf(fe, "%f", &c.moyfr);
|
|
|
|
|
fscanf(fe, "%f", &c.moyen);
|
|
|
|
|
fscanf(fe, "%f", &c.moyspe);
|
|
|
|
|
fscanf(fe, "%d%*c", &c.nbchx);
|
|
|
|
|
return cand;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
######################################### LISTES ##########################################
|
|
|
|
|
//######################################### LISTES ##########################################
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void AffListeCandidat (Liste l){
|
|
|
|
|
void AffListeCandidat (Listecand l){
|
|
|
|
|
|
|
|
|
|
if ( l == NULL) return;
|
|
|
|
|
AffC(l->cand);
|
|
|
|
|
AffListeCandidat(l->suivcand);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Liste recherche (Liste l, char *nom ){
|
|
|
|
|
Listecand recherche (Listecand l, char *nom ){
|
|
|
|
|
if ( l == NULL ){ return l;}
|
|
|
|
|
if ( strcmp ( l->Candidat.nom, nom ) == 0) return l;
|
|
|
|
|
return recherche (l->suivant, nom );
|
|
|
|
|
if ( strcmp ( l->cand.nom, nom ) == 0) return l;
|
|
|
|
|
return recherche (l->suivcand, nom );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Listecand InsertT(Listecand list, Candidat c)//Insert en tête de la liste
|
|
|
|
|
{
|
|
|
|
|
Mailloncand *c1;
|
|
|
|
|
|
|
|
|
|
c1 = (Mailloncand*)malloc(sizeof(Mailloncand));
|
|
|
|
|
if (c1 == NULL){printf("pb malloc"); exit;}
|
|
|
|
|
strcpy(c1->cand.nom, c.nom);
|
|
|
|
|
strcpy(c1->cand.prenom, c.prenom);
|
|
|
|
|
c1->cand.moymat = c.moymat;
|
|
|
|
|
c1->cand.moyfr = c.moyfr;
|
|
|
|
|
c1->cand.moyen = c.moyen;
|
|
|
|
|
c1->cand.moyspe = c.moyspe;
|
|
|
|
|
c1->cand.nbchx = c.nbchx;
|
|
|
|
|
c1->suivcand = list;
|
|
|
|
|
return c1;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Listecand Insert(Listecand list, Mailloncand * c)//insert globalement
|
|
|
|
|
{
|
|
|
|
|
if (list == NULL){return InsertT(list, c);}
|
|
|
|
|
if (strcmp(list->departement, m->departement)>0){return InsertT(list, m);}
|
|
|
|
|
list->suiv = Insert(list->suiv, m);
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -118,10 +140,13 @@ void test (void){
|
|
|
|
|
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");
|
|
|
|
|
scanf("%d", &menu1);
|
|
|
|
|
printf("%d", menu1);
|
|
|
|
|
|
|
|
|
|
while (menu1 != 1 || menu1 !=2){// Traitement des erreurs
|
|
|
|
|
printf("Erreur de saisie veuillez refaire votre choix ! ");
|
|
|
|
|
printf("(1) Gestion Candidature\n(2) Affichage Candidature\n (3) Quitter");
|
|
|
|
|
while (menu1 != 1 && menu1 !=2){// Traitement des erreurs
|
|
|
|
|
printf("Erreur de saisie veuillez refaire votre choix ! \n");
|
|
|
|
|
printf("(1) Gestion Candidature\n");
|
|
|
|
|
printf("(2) Affichage Candidature\n");
|
|
|
|
|
printf("(3) Quitter\n");
|
|
|
|
|
scanf("%d", &menu1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -132,14 +157,14 @@ void test (void){
|
|
|
|
|
|
|
|
|
|
if (menugest1 == 1)
|
|
|
|
|
//FONCTION INSERTION LISTE AVEC AFFICHAGE NOUVELLE LISTE
|
|
|
|
|
else if (menugest1 == 2)
|
|
|
|
|
//else if (menugest1 == 2)
|
|
|
|
|
//FONCTION MISE A JOUR LISTE AVEC AFFICHAGE NOUVELLE LISTE
|
|
|
|
|
else if (menugest1 == 3)
|
|
|
|
|
//else if (menugest1 == 3)
|
|
|
|
|
//FONCTION SUPPRESSION LISTE AVEC AFFICHAGE NOUVELLE LISTE
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if (menu1 == 2){
|
|
|
|
|
printf("")
|
|
|
|
|
//}
|
|
|
|
|
//else if (menu1 == 2){
|
|
|
|
|
printf("");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -185,4 +210,4 @@ void test (void){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
####################################### FILES #################################################
|
|
|
|
|
//####################################### FILES #################################################
|