parent
2f406bdd83
commit
f1abbb31a1
@ -0,0 +1,14 @@
|
||||
7
|
||||
13.78
|
||||
6
|
||||
11.00
|
||||
5
|
||||
12.44
|
||||
4
|
||||
8.58
|
||||
3
|
||||
10.47
|
||||
2
|
||||
16.11
|
||||
1
|
||||
14.53
|
@ -0,0 +1,330 @@
|
||||
/**
|
||||
* \file sae102.h
|
||||
* \author Erwan. M & Corentin. L
|
||||
* \date 11/12/22
|
||||
* \brief Résumé : Fichier .h regroupant les fonctions utilisées dans SAE2.c
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
typedef struct maillon{
|
||||
|
||||
char departement[32];
|
||||
|
||||
int nbP;
|
||||
|
||||
char nomResp[22];
|
||||
|
||||
struct maillon *suiv;
|
||||
|
||||
}MaillonDept, *ListeDept;
|
||||
|
||||
typedef struct{
|
||||
|
||||
char ville[30];
|
||||
|
||||
ListeDept ldept;
|
||||
|
||||
}VilleIUT;
|
||||
|
||||
typedef struct maillonNotes{
|
||||
|
||||
float v;
|
||||
|
||||
struct maillonNotes *suiv;
|
||||
|
||||
}MaillonNotes, *ListeNotes;
|
||||
|
||||
typedef struct{
|
||||
|
||||
char ville[30];
|
||||
|
||||
char departement[30];
|
||||
|
||||
int decision;
|
||||
|
||||
int validation;
|
||||
|
||||
}Choix;
|
||||
|
||||
typedef struct maillonChoix{
|
||||
|
||||
Choix c;
|
||||
|
||||
struct maillonChoix *suiv;
|
||||
|
||||
}MaillonChoix, *ListeChoix;
|
||||
|
||||
typedef struct{
|
||||
|
||||
int numCandid;
|
||||
|
||||
char nom[30];
|
||||
|
||||
char prenom[30];
|
||||
|
||||
float notes[4];
|
||||
|
||||
ListeChoix choix;
|
||||
|
||||
}Candidat;
|
||||
|
||||
typedef struct maillonCandidat{
|
||||
|
||||
Candidat c;
|
||||
|
||||
struct maillonCandidat *suiv;
|
||||
|
||||
}MaillonCandidat, *ListeCandidats;
|
||||
|
||||
typedef struct maillonFile{
|
||||
|
||||
Candidat c;
|
||||
|
||||
struct maillonFile *suiv;
|
||||
|
||||
}MaillonFile, *File;
|
||||
|
||||
void menuPrincipal(void);
|
||||
|
||||
void sousMenuAdministrateur(VilleIUT **tiut, int tlog, int *etatPhase, ListeCandidats liste);
|
||||
|
||||
void switchAdministrateur(int choix, VilleIUT** tiut, int tlog, int *etatPhase, ListeCandidats liste);
|
||||
|
||||
int fonctionChoix(void);
|
||||
|
||||
void affichageSousMenuUtilisateur(void);
|
||||
|
||||
void switchUtilisateur(int choix, VilleIUT **tiut, int tlog, ListeCandidats liste, ListeCandidats *admis, File *attente, int *etatPhase);
|
||||
|
||||
void sousMenuUtilisateur(VilleIUT **tiut, int tlog, ListeCandidats liste, ListeCandidats *admis, File *attente, int *etatPhase);
|
||||
|
||||
void clear(void);
|
||||
|
||||
int phaseCandid(void);
|
||||
|
||||
void switchPhase(int *etat);
|
||||
|
||||
void modifFichierPhase(int etat);
|
||||
|
||||
void rechercheDeptTousCandidat(ListeCandidats liste, char* nomVille, char* nomDep);
|
||||
|
||||
ListeDept inserer(ListeDept l, char* departement, int nbP, char* nomResp);
|
||||
|
||||
ListeDept insererEnTete(ListeDept l, char* departement, int nbP, char* nomResp);
|
||||
|
||||
int saisieNbPlaces(int *nbP);
|
||||
|
||||
void modifResp(VilleIUT* tiut[], int positionTab, int position, char* nomResp);
|
||||
|
||||
void sousMenuResponsable(ListeCandidats liste, ListeCandidats *admis, File *attente);
|
||||
|
||||
void affichageSousMenuResponsable(void);
|
||||
|
||||
void switchResponsable(int choix, ListeCandidats liste, ListeCandidats *admis, File *attente);
|
||||
|
||||
int rechercheCandidat(ListeCandidats liste, char* nom, char* prenom, int *trouve);
|
||||
|
||||
void affichageMenuPrincipal(void);
|
||||
|
||||
void affichageMenuPrincipal2(void);
|
||||
|
||||
void switchPrincipal(int choix, VilleIUT **tiut, int tlog, int *etatPhase, ListeCandidats liste, ListeCandidats *admis, File *attente);
|
||||
|
||||
void affichageErreurSaisie(void);
|
||||
|
||||
void affichageMenuAdministrateur(void);
|
||||
|
||||
void affichageErreurMdp(void);
|
||||
|
||||
int saisieNvResp(char resp[]);
|
||||
|
||||
void attributionNote(ListeCandidats liste, int tlog);
|
||||
|
||||
int ecritureNoteMoyenne(ListeCandidats liste, int tlog);
|
||||
|
||||
int saisieDept(char departement[]);
|
||||
|
||||
int saisieNbPlace(void);
|
||||
|
||||
ListeDept supprimer(ListeDept l, char* departement);
|
||||
|
||||
ListeDept supprimerEnTete(ListeDept l);
|
||||
|
||||
int chargerFichier(VilleIUT *tiut[], int tmax);
|
||||
|
||||
VilleIUT lireVille(FILE* flot);
|
||||
|
||||
void afficher(VilleIUT* tiut[], int tlog);
|
||||
|
||||
int saisieVille(char* ville, VilleIUT** tiut, int tlog);
|
||||
|
||||
int insertionVille(VilleIUT* tiut[], VilleIUT vIUT, int tlog);
|
||||
|
||||
int rechercheVille(VilleIUT** tiut, char ville[], int tlog, int *trouve);
|
||||
|
||||
void afficherListe(ListeDept l);
|
||||
|
||||
void decalageADroite(VilleIUT *tiut[], int tlog, int index);
|
||||
|
||||
void sauvegarderListe(ListeDept l, FILE* flot, char* ville);
|
||||
|
||||
int rechercheDepartement(VilleIUT* tiut[], char ville[], char departement[], int tlog, int *trouve);
|
||||
|
||||
int rechercheDept(ListeDept l, char departement[], int *trouve, int compteur);
|
||||
|
||||
void modifNbPlaces(VilleIUT* tiut[], int positionTab, int position, int nbP);
|
||||
|
||||
void afficherVillesIUT(VilleIUT *tiut[], int tlog);
|
||||
|
||||
void afficherDepartementsIUT(VilleIUT *tiut[], int pos);
|
||||
|
||||
void afficherNbPlaces(VilleIUT **tiut, int tlog, char* ville, char* departement);
|
||||
|
||||
void nbPDepartement(VilleIUT** tiut, int tlog);
|
||||
|
||||
void rechercheTousDepartement(VilleIUT** tiut, int tlog, char* departement, int *trouve);
|
||||
|
||||
ListeCandidats chargerBinCandidats(ListeCandidats liste, int *tlog);
|
||||
|
||||
ListeCandidats chargerTxtCandidats(ListeCandidats liste, int *tlog);
|
||||
|
||||
int lectureMoyennes(int tabNumCandidat[30], float tabMoyennes[30]);
|
||||
|
||||
Candidat lireBinCandidat(FILE* flot);
|
||||
|
||||
ListeChoix lireBinChoix(FILE* flot, int nbChoix);
|
||||
|
||||
Candidat lireTxtCandidat(FILE* flot);
|
||||
|
||||
ListeChoix lireTxtChoix(FILE* flot, int nbChoix);
|
||||
|
||||
ListeChoix ajouterChoix(ListeChoix liste, Choix choix);
|
||||
|
||||
ListeCandidats insertionCandidat(ListeCandidats liste, Candidat c);
|
||||
|
||||
ListeCandidats listeCandidatsNouv();
|
||||
|
||||
ListeChoix listeChoixNouv();
|
||||
|
||||
void affichageCandidats(ListeCandidats liste);
|
||||
|
||||
void gestionCandidats(ListeCandidats liste, int tlog, float noteMin, int maxAdmis);
|
||||
|
||||
void affichageChoix(ListeChoix liste);
|
||||
|
||||
void sauverCandidats(ListeCandidats liste, int tlog, char* nomFichier);
|
||||
|
||||
void sauverChoix(FILE *flot, ListeChoix liste);
|
||||
|
||||
int longueurListeChoix(ListeChoix liste);
|
||||
|
||||
void afficher1Candidat(Candidat c);
|
||||
|
||||
int longueurListeCandidats(ListeCandidats liste);
|
||||
|
||||
File filenouv(void);
|
||||
|
||||
File adjonctionEnQueueFile(File f, Candidat c);
|
||||
|
||||
File suppressionEnTeteFile(File f);
|
||||
|
||||
Candidat teteFile(File f);
|
||||
|
||||
int longueurFile(File f);
|
||||
|
||||
bool videFile(File f);
|
||||
|
||||
void afficherFile(File f);
|
||||
|
||||
ListeCandidats rechercheVoeux(ListeCandidats l);
|
||||
|
||||
void triSelection(int tabNumCandidat[30], float tabMoyennes[30], int tlog);
|
||||
|
||||
ListeCandidats changerDecisionAdmis(ListeCandidats listeC, int maxAdmis, int noteMin, File* attente);
|
||||
|
||||
int rechercheDeptCandidat(ListeChoix l);
|
||||
|
||||
void rechercheDeptCandidatE(ListeChoix l, char* nomVille, char* NomDep, ListeCandidats liste);
|
||||
|
||||
void sousMenuCandidature(Candidat c, VilleIUT** tiut, int tlog, ListeCandidats *admis, File *attente, int *etatPhase);
|
||||
|
||||
void affichageSousMenuCandidature(void);
|
||||
|
||||
void switchCandidature(int choix, Candidat c, VilleIUT** tiut, int tlog, ListeCandidats *admis, File *attente, int *etatPhase);
|
||||
|
||||
ListeChoix supprimerVoeuxCandidatEnTete(ListeChoix choix);
|
||||
|
||||
ListeChoix supprimerVoeuxCandidat(ListeChoix choix, char* ville, char* departement, int* trouve);
|
||||
|
||||
ListeCandidats supprimerEnTeteCandidats(ListeCandidats l);
|
||||
|
||||
ListeCandidats supprimerCandidats(ListeCandidats l, int numCandid);
|
||||
|
||||
ListeCandidats actualiseDecision(File file, ListeCandidats liste, int decision);
|
||||
|
||||
ListeCandidats listerCandidats(File file, ListeCandidats liste, int decision);
|
||||
|
||||
ListeChoix modifieDecision(ListeChoix liste, int decision);
|
||||
|
||||
ListeCandidats changeDecision(ListeCandidats liste, int tlog, float noteMin, int maxAdmis, ListeCandidats *admis, File *attente);
|
||||
|
||||
ListeCandidats refuser(ListeCandidats listeC, ListeCandidats liste, float noteMin);
|
||||
|
||||
ListeCandidats listerRefuse(ListeCandidats listeC, ListeCandidats liste, int decision);
|
||||
|
||||
Candidat plusGrand(ListeCandidats liste, int *pge);
|
||||
|
||||
ListeCandidats copierListeCandidats(ListeCandidats liste);
|
||||
|
||||
void sauverFile(File file, char* nomFichier);
|
||||
|
||||
File chargerBinFile(File file, char* nomFichier);
|
||||
|
||||
void libererFile(File file);
|
||||
|
||||
ListeCandidats remettreAZero(File *file, ListeCandidats listeC);
|
||||
|
||||
ListeChoix remetChoixZero(ListeChoix liste);
|
||||
|
||||
void freeFile(MaillonFile *file);
|
||||
|
||||
ListeChoix validationVoeux(ListeChoix liste, char *ville, char *departement, int decision);
|
||||
|
||||
ListeChoix validerVoeux(ListeChoix liste, char *ville, char *departement, ListeCandidats *admis, File *attente, int numCandid);
|
||||
|
||||
ListeCandidats diviserFusion(ListeCandidats liste);
|
||||
|
||||
ListeCandidats fusionListes(ListeCandidats liste, ListeCandidats liste2);
|
||||
|
||||
ListeCandidats triFusion(ListeCandidats liste);
|
||||
|
||||
void affichageCandidatAdmis(Candidat c, int decision);
|
||||
|
||||
int rechercheCandidatVoeu(ListeChoix liste, char* ville, char* departement, int* validation, int *decision);
|
||||
|
||||
ListeCandidats insererCandidats(ListeCandidats l, Candidat c);
|
||||
|
||||
ListeCandidats supprimerCandidats(ListeCandidats l, int numCandid);
|
||||
|
||||
ListeCandidats insererEnTeteListeCandidats(ListeCandidats l, Candidat c);
|
||||
|
||||
ListeCandidats chargerBinListe(ListeCandidats liste, char* nomFichier, int *tlog);
|
||||
|
||||
ListeCandidats listerListeCandidats(ListeCandidats listeAdmis, ListeCandidats liste, int decision);
|
||||
|
||||
ListeCandidats actualiseDecisionListe(ListeCandidats listeAdmis, ListeCandidats liste, int decision);
|
||||
|
||||
void freeListe(ListeCandidats liste);
|
||||
|
||||
ListeCandidats remettreAZeroListe(ListeCandidats *listeAdmis, ListeCandidats listeC);
|
||||
|
||||
int rechercheCandidatAdmis(ListeCandidats liste, char *nom, char *prenom, int *trouveCandidat, int *trouveVoeu, char *ville, char *departement);
|
||||
|
||||
int recherche1Voeu(ListeChoix liste, char *ville, char *departement, int *trouveVoeu);
|
@ -0,0 +1,170 @@
|
||||
/**
|
||||
* \file sae102.h
|
||||
* \author Erwan. M & Corentin. L
|
||||
* \date 12/12/23
|
||||
* \brief Résumé : Fichier .c regroupant la fonction main pour lancer le programme et les tests
|
||||
*/
|
||||
|
||||
#include "sae102.h"
|
||||
|
||||
void testRechDept(void){
|
||||
|
||||
VilleIUT *tiut[30];
|
||||
|
||||
int tlog, pos, trouve;
|
||||
|
||||
tlog = chargerFichier(tiut, 30);
|
||||
|
||||
pos = rechercheDepartement(tiut, "Clermont-Ferrand\0", "Biologie\0", tlog, &trouve);
|
||||
|
||||
if (trouve == 1)
|
||||
|
||||
printf("Trouvé, position : %d\n", pos);
|
||||
|
||||
else
|
||||
|
||||
printf("Introuvable ! Position pour insérer : %d\n", pos);
|
||||
|
||||
}
|
||||
|
||||
void testPartDeux(void){
|
||||
|
||||
ListeCandidats liste;
|
||||
|
||||
liste = listeCandidatsNouv();
|
||||
|
||||
int tlog;
|
||||
|
||||
liste = chargerTxtCandidats(liste, &tlog);
|
||||
|
||||
affichageCandidats(liste);
|
||||
|
||||
sauverCandidats(liste, tlog, "candidats.bin");
|
||||
|
||||
liste = listeCandidatsNouv();
|
||||
|
||||
liste = chargerBinCandidats(liste, &tlog);
|
||||
|
||||
affichageCandidats(liste);
|
||||
|
||||
}
|
||||
|
||||
void testAfficherFile(void){
|
||||
|
||||
File f = filenouv();
|
||||
|
||||
Candidat c, ca, can;
|
||||
|
||||
Choix choix, choix2;
|
||||
|
||||
strcpy(choix.ville,"MarcelVille\0");
|
||||
|
||||
strcpy(choix.departement,"MARCEL\0");
|
||||
|
||||
choix.decision = 0;
|
||||
|
||||
choix.validation = 0;
|
||||
|
||||
strcpy(choix2.ville,"MarcelCity\0");
|
||||
|
||||
strcpy(choix2.departement,"CEL\0");
|
||||
|
||||
choix2.decision = 0;
|
||||
|
||||
choix2.validation = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
c.numCandid = 1;
|
||||
|
||||
strcpy(c.nom, "Marcel\0");
|
||||
|
||||
strcpy(c.prenom, "EMarcel\0");
|
||||
|
||||
c.notes[0] = 15;
|
||||
|
||||
c.notes[1] = 12;
|
||||
|
||||
c.notes[2] = 9;
|
||||
|
||||
c.notes[3] = 19;
|
||||
|
||||
c.choix = listeChoixNouv();
|
||||
|
||||
c.choix = ajouterChoix(c.choix, choix);
|
||||
|
||||
|
||||
ca.numCandid = 2;
|
||||
|
||||
strcpy(ca.nom, "Mirouge\0");
|
||||
|
||||
strcpy(ca.prenom, "tel\0");
|
||||
|
||||
ca.notes[0] = 1;
|
||||
|
||||
ca.notes[1] = 2;
|
||||
|
||||
ca.notes[2] = 91;
|
||||
|
||||
ca.notes[3] = 9;
|
||||
|
||||
ca.choix = listeChoixNouv();
|
||||
|
||||
ca.choix = ajouterChoix(ca.choix, choix2);
|
||||
|
||||
ca.choix = ajouterChoix(ca.choix, choix);
|
||||
|
||||
ca.choix = ajouterChoix(ca.choix, choix2);
|
||||
|
||||
ca.choix = ajouterChoix(ca.choix, choix);
|
||||
|
||||
|
||||
can.numCandid = 3;
|
||||
|
||||
strcpy(can.nom, "Pierre\0");
|
||||
|
||||
strcpy(can.prenom, "Maredesel\0");
|
||||
|
||||
can.notes[0] = 17;
|
||||
|
||||
can.notes[1] = 10;
|
||||
|
||||
can.notes[2] = 11;
|
||||
|
||||
can.notes[3] = 12;
|
||||
|
||||
can.choix = listeChoixNouv();
|
||||
|
||||
can.choix = ajouterChoix(can.choix, choix2);
|
||||
|
||||
can.choix = ajouterChoix(can.choix, choix2);
|
||||
|
||||
afficher1Candidat(c);
|
||||
|
||||
afficher1Candidat(ca);
|
||||
|
||||
afficher1Candidat(can);
|
||||
|
||||
|
||||
f = adjonctionEnQueueFile(f, c);
|
||||
|
||||
f = adjonctionEnQueueFile(f, ca);
|
||||
|
||||
f = adjonctionEnQueueFile(f, can);
|
||||
|
||||
afficherFile(f);
|
||||
|
||||
}
|
||||
|
||||
int main(void){
|
||||
|
||||
//testPartDeux();
|
||||
|
||||
//testRechDept();
|
||||
|
||||
//testAfficherFile();
|
||||
|
||||
menuPrincipal();
|
||||
|
||||
}
|
Loading…
Reference in new issue