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.
188 lines
3.3 KiB
188 lines
3.3 KiB
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include "commun.h"
|
|
|
|
|
|
##########################TABLEAU POINTEUR#####################################################
|
|
|
|
|
|
Choix lirechx (void){//Fonction qui va lire les choix de la ville et du departement demandé par le candidat
|
|
Choix chx;
|
|
|
|
printf("Saisir le choix de la ville \n");
|
|
fgets(chx.ville, 20, stdin);
|
|
chx.ville[strlen(chx.ville)-1]= '\0';
|
|
|
|
printf("Saisir le choix du departement d'étude\n");
|
|
fgets(chx.dptmt, 20, stdin);
|
|
chx.dptmt[strlen(chx.dptmt)-1]= '\0';
|
|
|
|
chx.dec = 0;
|
|
chx.valid = 0;
|
|
return chx;
|
|
}
|
|
|
|
|
|
|
|
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';
|
|
printf("Prénom du candidat :\n");
|
|
fgets(c.prenom, 20, stdin);
|
|
c.prenom[strlen(c.prenom)-1]= '\0';
|
|
printf("Moyenne de maths :\n");
|
|
scanf("%f", &c.moymat);
|
|
printf("Moyenne de français :\n");
|
|
scanf("%f", &c.moyfr);
|
|
printf("Moyenne d'anglais :\n");
|
|
scanf("%f", &c.moyen);
|
|
printf("Moyenne de spécialité au choix :\n");
|
|
scanf("%f", &c.moyspe);
|
|
printf("Nombre de choix :\n");
|
|
scanf("%d%*c", &c.nbchx);
|
|
return c;
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
Choix * chargeChoix(Choix *tchoix, TAILLE, nbchx){
|
|
|
|
}
|
|
*/
|
|
|
|
|
|
|
|
|
|
void AffC(Candidat c)
|
|
{
|
|
printf("%s \n %s\n", c.nom, c.prenom);
|
|
printf("%.2f\t%.2f\t%.2f\t%.2f\n", c.moymat,c.moyfr, c.moyen, c.moyspe);
|
|
printf("%d\n", c.nbchx);
|
|
}
|
|
|
|
|
|
Candidat lireFich1Cand (FILE * fe){
|
|
Candidat cand;
|
|
|
|
fgets(cand.nom, 20, fe);
|
|
c.nom[strlen(c.nom)-1]= '\0';
|
|
|
|
fgets(c.prenom, 20, fe);
|
|
c.prenom[strlen(cand.prenom)-1]= '\0';
|
|
|
|
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);
|
|
}
|
|
|
|
######################################### LISTES ##########################################
|
|
|
|
|
|
|
|
void AffListeCandidat (Liste l){
|
|
|
|
if ( l == NULL) return;
|
|
AffC(l->cand);
|
|
AffListeCandidat(l->suivcand);
|
|
}
|
|
|
|
Liste recherche (Liste l, char *nom ){
|
|
if ( l == NULL ){ return l;}
|
|
if ( strcmp ( l->Candidat.nom, nom ) == 0) return l;
|
|
return recherche (l->suivant, nom );
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void test (void){
|
|
|
|
int menu1, menugest1;
|
|
|
|
|
|
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);
|
|
|
|
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");
|
|
scanf("%d", &menu1);
|
|
}
|
|
|
|
if (menu1 == 1){
|
|
printf("Menu : \n");//Menu gestion ajout/modification/suppression d'une candidature
|
|
printf("(1) Ajouter une Candidature\n (2) Modifier une Candidature\n (3) Supprimer une Candidature");
|
|
scanf("%d", &menugest1);
|
|
|
|
if (menugest1 == 1)
|
|
//FONCTION INSERTION LISTE AVEC AFFICHAGE NOUVELLE LISTE
|
|
else if (menugest1 == 2)
|
|
//FONCTION MISE A JOUR LISTE AVEC AFFICHAGE NOUVELLE LISTE
|
|
else if (menugest1 == 3)
|
|
//FONCTION SUPPRESSION LISTE AVEC AFFICHAGE NOUVELLE LISTE
|
|
|
|
}
|
|
else if (menu1 == 2){
|
|
printf("")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
####################################### FILES ################################################# |