|
|
|
@ -5,6 +5,7 @@
|
|
|
|
|
|
|
|
|
|
// Partie 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// PARTIE ENREGISTREMENT
|
|
|
|
|
Listdept initialisation(void) {
|
|
|
|
|
return NULL;
|
|
|
|
@ -219,6 +220,7 @@ void supprDepartement(VilleIUT *tville[], int *nbville) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void modifNomResponsable(VilleIUT *tville[], int nbville) {
|
|
|
|
|
int i = rechercheVille(tville, nbville);
|
|
|
|
|
if (i == -1) return;
|
|
|
|
@ -283,84 +285,138 @@ void sauvegarde(VilleIUT *tville[], int nbville) {
|
|
|
|
|
|
|
|
|
|
// MENU PARTIE 1
|
|
|
|
|
|
|
|
|
|
void menuP1Utilisateur(VilleIUT *v[], int nb) {
|
|
|
|
|
int choixP1U = 0;
|
|
|
|
|
printf("---------------------- MENU UTILISATEUR -----------------------\n\n");
|
|
|
|
|
|
|
|
|
|
printf(" 1 - Consulter les villes avec un IUT\n");
|
|
|
|
|
printf(" 2 - Consulter les départements d'un IUT\n");
|
|
|
|
|
printf(" 3 - Consulter le nombre de place des départements\n");
|
|
|
|
|
printf(" 4 - Consulter les IUT possédant un certain département\n\n");
|
|
|
|
|
|
|
|
|
|
printf(" 9 - Retour\n");
|
|
|
|
|
void menuP1Utilisateur(VilleIUT *tabVille[], int nb) {
|
|
|
|
|
int choixP1U;
|
|
|
|
|
|
|
|
|
|
while (choixP1U >= 1 || choixP1U <= 4) {
|
|
|
|
|
printf("\n");
|
|
|
|
|
printf("---------------------- MENU UTILISATEUR -----------------------\n");
|
|
|
|
|
printf("| |\n");
|
|
|
|
|
printf("| 1 - Consulter les villes avec un IUT |\n");
|
|
|
|
|
printf("| 2 - Consulter les départements d'un IUT |\n");
|
|
|
|
|
printf("| 3 - Consulter le nombre de place des départements |\n");
|
|
|
|
|
printf("| 4 - Consulter les IUT possédant un certain département |\n");
|
|
|
|
|
printf("| |\n");
|
|
|
|
|
printf("| 9 - Retour |\n");
|
|
|
|
|
printf("| |\n");
|
|
|
|
|
printf("| Votre choix => ");
|
|
|
|
|
scanf("%d", &choixP1U);
|
|
|
|
|
printf("---------------------------------------------------------------\n");
|
|
|
|
|
printf("\n");
|
|
|
|
|
switch (choixP1U) {
|
|
|
|
|
case 1:
|
|
|
|
|
afficheVilleIUT(v, nb);
|
|
|
|
|
afficheVilleIUT(tabVille, nb);
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
afficheDepartementsIUT(v, nb);
|
|
|
|
|
afficheDepartementsIUT(tabVille, nb);
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
affichageville(v, nb);
|
|
|
|
|
affichageville(tabVille, nb);
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
afficheIUTdepParticulier(v, nb);
|
|
|
|
|
afficheIUTdepParticulier(tabVille, nb);
|
|
|
|
|
break;
|
|
|
|
|
case 9:
|
|
|
|
|
sauvegarde(v, nb);// mettre menu général
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void menuP1Administrateur(VilleIUT *v[], int nb) {
|
|
|
|
|
void menuP1Administrateur(VilleIUT *tabVille[], int nb, listetuinfo *tetu[], int nbEtu, DepartementVille *departementVille) {
|
|
|
|
|
int choixP1A = 0;
|
|
|
|
|
printf("---------------------- MENU UTILISATEUR -----------------------\n\n");
|
|
|
|
|
|
|
|
|
|
printf(" 1 - Modifier le nombre de place d'un département\n");
|
|
|
|
|
printf(" 2 - Créer un département\n");
|
|
|
|
|
printf(" 3 - Créer un IUT\n");
|
|
|
|
|
printf(" 4 - Supprimer un département\n\n");
|
|
|
|
|
printf(" 5 - Modifier le nom d'un responsable\n\n");
|
|
|
|
|
|
|
|
|
|
printf(" 9 - Retour\n");
|
|
|
|
|
|
|
|
|
|
while (choixP1A >= 1 || choixP1A <= 4) {
|
|
|
|
|
printf("\n");
|
|
|
|
|
printf("---------------------- MENU ADMINISTRATEUR -----------------------\n");
|
|
|
|
|
printf("| |\n");
|
|
|
|
|
printf("| 1 - Modifier le nombre de place d'un département |\n");
|
|
|
|
|
printf("| 2 - Créer un département |\n");
|
|
|
|
|
printf("| 3 - Créer un IUT |\n");
|
|
|
|
|
printf("| 4 - Supprimer un département |\n");
|
|
|
|
|
printf("| 5 - Modifier nom responsable |\n");
|
|
|
|
|
printf("| 6 - Lancer analyse candidature |\n");
|
|
|
|
|
printf("| 7 - Afficher liste DES candidatures |\n");
|
|
|
|
|
printf("| |\n");
|
|
|
|
|
printf("| 9 - Retour |\n");
|
|
|
|
|
printf("| Votre choix => ");
|
|
|
|
|
scanf("%d", &choixP1A);
|
|
|
|
|
printf("------------------------------------------------------------------\n");
|
|
|
|
|
printf("\n");
|
|
|
|
|
switch (choixP1A) {
|
|
|
|
|
case 1:
|
|
|
|
|
modifPlace(v, nb);
|
|
|
|
|
modifPlace(tabVille, nb);
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
ajoutDept(-1, v, nb);
|
|
|
|
|
ajoutDept(-1, tabVille, nb);
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
ajoutIUT(v, &nb, 100);
|
|
|
|
|
ajoutIUT(tabVille, &nb, 100);
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
supprDepartement(v, &nb);
|
|
|
|
|
supprDepartement(tabVille, &nb);
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
modifNomResponsable(v, nb);
|
|
|
|
|
modifNomResponsable(tabVille, nb);
|
|
|
|
|
break;
|
|
|
|
|
case 6:
|
|
|
|
|
departementVille = useAllFunctionsCandidature(tetu, nbEtu);
|
|
|
|
|
printf("L'analyse et le classement a bien été effectué !\n");
|
|
|
|
|
break;
|
|
|
|
|
case 7:
|
|
|
|
|
affichealletu(tetu, nbEtu);
|
|
|
|
|
break;
|
|
|
|
|
case 9:
|
|
|
|
|
sauvegarde(v, nb);// mettre menu général
|
|
|
|
|
sauvegarde(tabVille, nb);// mettre menu général
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
void test(void){
|
|
|
|
|
VilleIUT *v[100];
|
|
|
|
|
int nb = chargeIUT(v, 100);
|
|
|
|
|
affichageville(v, nb);
|
|
|
|
|
affichageville(v, nb);
|
|
|
|
|
void menuPrincipal(VilleIUT *tabVille[], int nb, listetuinfo *tetu[], int nbEtu, DepartementVille* departementVille) {
|
|
|
|
|
int choix = 0;
|
|
|
|
|
while (choix >= 1 || choix <= 4) {
|
|
|
|
|
printf("\n");
|
|
|
|
|
printf("---------------------- MENU PRINCIPAL -----------------------\n");
|
|
|
|
|
printf("| |\n");
|
|
|
|
|
printf("| 1 - Utilisateur |\n");
|
|
|
|
|
printf("| 2 - Administrateur |\n");
|
|
|
|
|
printf("| |\n");
|
|
|
|
|
printf("| 9 - Quitter |\n");
|
|
|
|
|
printf("| |\n");
|
|
|
|
|
printf("| Votre choix => ");
|
|
|
|
|
scanf("%d", &choix);
|
|
|
|
|
printf("-------------------------------------------------------------\n");
|
|
|
|
|
printf("\n");
|
|
|
|
|
switch (choix) {
|
|
|
|
|
case 1:
|
|
|
|
|
menuP1Utilisateur(tabVille, nb);
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
menuP1Administrateur(tabVille, nb, tetu, nbEtu, departementVille);
|
|
|
|
|
break;
|
|
|
|
|
case 9:
|
|
|
|
|
sauvegarde(tabVille, nb);
|
|
|
|
|
//sauvegardeTabRespFichier(tabVille, nb, tabResp);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sauvegarde(v, nb);
|
|
|
|
|
|
|
|
|
|
afficheVilleIUT(v, nb);
|
|
|
|
|
afficheDepartementsIUT(v, nb);
|
|
|
|
|
afficheIUTdepParticulier(v, nb);
|
|
|
|
|
modifPlace(v, nb);
|
|
|
|
|
affichageville(v, nb);
|
|
|
|
|
ajoutIUT(v, &nb, 100);
|
|
|
|
|
ajoutDept(-1, v, nb);
|
|
|
|
|
supprDepartement(v, &nb);
|
|
|
|
|
affichageville(v, nb);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void test(void){
|
|
|
|
|
#define TAILLEMAX 200
|
|
|
|
|
VilleIUT *tabVille[TAILLEMAX];
|
|
|
|
|
int nb = chargeIUT(tabVille, TAILLEMAX);
|
|
|
|
|
|
|
|
|
|
listetuinfo *tetu[TAILLEMAX];
|
|
|
|
|
int nbEtu;
|
|
|
|
|
char nomFich[20];
|
|
|
|
|
strcpy( nomFich, "candidature.txt");
|
|
|
|
|
nbEtu = chargeretudiant(nomFich, tetu, 5000);
|
|
|
|
|
|
|
|
|
|
DepartementVille* departementVille;
|
|
|
|
|
menuPrincipal(tabVille, nb, tetu, nbEtu, departementVille);
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
// Partie 2
|
|
|
|
|
|
|
|
|
@ -705,36 +761,76 @@ void test1(void){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DepartementVille* recupererEtudiantsDepartementVille(listetuinfo* etudiants[], int nbEtudiants, char* ville, char* dep) {
|
|
|
|
|
DepartementVille* departementVille = malloc(sizeof(DepartementVille));
|
|
|
|
|
departementVille->nbEtudiants = 0;
|
|
|
|
|
strcpy(departementVille->ville, ville);
|
|
|
|
|
strcpy(departementVille->departement, dep);
|
|
|
|
|
|
|
|
|
|
departementVille->etudiants = malloc(nbEtudiants * sizeof(listetuinfo));
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < nbEtudiants; i++) {
|
|
|
|
|
// si l'étudiant a fait le choix de ce département dans cette ville, l'ajouter au tableau de la structure
|
|
|
|
|
if (strcmp(etudiants[i]->carte->Ville, ville) == 0 && strcmp(etudiants[i]->carte->dep, dep) == 0) {
|
|
|
|
|
etudiants[i]->moyenne = calculerMoyenne(*etudiants[i]);
|
|
|
|
|
|
|
|
|
|
// ajouter l'étudiant au tableau de la structure
|
|
|
|
|
departementVille->etudiants[departementVille->nbEtudiants] = etudiants[i];
|
|
|
|
|
departementVille->nbEtudiants++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return departementVille;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float calculerMoyenne(listetuinfo etudiant) {
|
|
|
|
|
float somme = 0.0;
|
|
|
|
|
for (int i = 0; i < 4; i++) {
|
|
|
|
|
somme += etudiant.notes[i];
|
|
|
|
|
}
|
|
|
|
|
return somme / 4.0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void trierDepartementVille(DepartementVille* departementVille, int nbElements) {
|
|
|
|
|
for (int i = 0; i < nbElements; i++) {
|
|
|
|
|
for (int j = i + 1; j < nbElements; j++) {
|
|
|
|
|
if (departementVille->etudiants[j]->moyenne > departementVille->etudiants[i]->moyenne) {
|
|
|
|
|
listetuinfo* etudiantTemp = departementVille->etudiants[i];
|
|
|
|
|
departementVille->etudiants[i] = departementVille->etudiants[j];
|
|
|
|
|
departementVille->etudiants[j] = etudiantTemp;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void comparerEtudiants(DepartementVille* departementVille, listetuinfo* etudiants, int nbPlaces) {
|
|
|
|
|
for (int i = 0; i < departementVille->nbEtudiants; i++) {
|
|
|
|
|
// si l'étudiant a une moyenne inférieure à 10, mettre sa variable "decision" à -1
|
|
|
|
|
if (departementVille->etudiants[i]->moyenne < 10) departementVille->etudiants[i]->carte->decision = -1;
|
|
|
|
|
// sinon, si l'index de l'étudiant est inférieur ou égal au nombre de places disponibles, mettre sa variable "decision" à 1
|
|
|
|
|
else if (i < nbPlaces) departementVille->etudiants[i]->carte->decision = 1;
|
|
|
|
|
// sinon, mettre sa variable "decision" à 2
|
|
|
|
|
else departementVille->etudiants[i]->carte->decision = 2;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DepartementVille* useAllFunctionsCandidature(listetuinfo* tetu[], int nbEtu) {
|
|
|
|
|
DepartementVille* departementVille;
|
|
|
|
|
departementVille = recupererEtudiantsDepartementVille(tetu, nbEtu, "clermont-ferrand", "informatique");
|
|
|
|
|
trierDepartementVille(departementVille, departementVille->nbEtudiants);
|
|
|
|
|
comparerEtudiants(departementVille, *tetu, 5);
|
|
|
|
|
return departementVille;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void afficherDepartementVille(DepartementVille* departementVille) {
|
|
|
|
|
printf("Ville : %s\n", departementVille->ville);
|
|
|
|
|
printf("Departement : %s\n", departementVille->departement);
|
|
|
|
|
printf("Nombre d'étudiants : %d\n", departementVille->nbEtudiants);
|
|
|
|
|
printf("Etudiants :\n");
|
|
|
|
|
for (int i = 0; i < departementVille->nbEtudiants; i++) {
|
|
|
|
|
printf("\t- %s %s (numero d'étudiant : %d, moyenne : %.2f decision : %d)\n", departementVille->etudiants[i]->nometu, departementVille->etudiants[i]->prenometu, departementVille->etudiants[i]->numeroetu, departementVille->etudiants[i]->moyenne, departementVille->etudiants[i]->carte->decision);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -752,11 +848,11 @@ void test1(void){
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// coté etu=========================================================================================================
|
|
|
|
|
// affichage
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
|
|
void affichagedepresultat(Maillonchoix* carte){
|
|
|
|
|
if(carte==NULL){return;}
|
|
|
|
|
if(carte->decision==1){
|
|
|
|
@ -786,116 +882,4 @@ void validation(char choixville[], char choixdep[], Maillonchoix* carte, int *ok
|
|
|
|
|
validation(choixville, choixdep, carte.suivant, ok);
|
|
|
|
|
if(ok==1){
|
|
|
|
|
if(carte.decision==1){
|
|
|
|
|
carte.validation=-1;
|
|
|
|
|
miseajourindep( lplace, nbplace, etu);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void enregistrementvalidation(char choixville[], char choixdep[], Maillonchoix* carte, int *ok, char nomFich[], listetuinfo *tetu[], int nb){
|
|
|
|
|
int ok;
|
|
|
|
|
validation( choixville, choixdep, carte, &ok);
|
|
|
|
|
enregistrementetudiants( nomFich, tetu, nb);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// -> mise a jour
|
|
|
|
|
|
|
|
|
|
Maillonatt miseajourfile(Maillonatt place, int nbplace, listetuinfo etu){
|
|
|
|
|
if(place==NULL){exit(1);}
|
|
|
|
|
if(place.munc==etu.numeroetu){
|
|
|
|
|
Maillonatt temp;
|
|
|
|
|
temp=place.suivant;
|
|
|
|
|
free(place);
|
|
|
|
|
return temp;
|
|
|
|
|
}
|
|
|
|
|
miseajourfile(place.suivant, nbplace-1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int miseajouratt(Maillonatt place, int nbplace){
|
|
|
|
|
if(place==NULL){return;}
|
|
|
|
|
if(nbplace==0){return;}
|
|
|
|
|
if(place.decision==2){
|
|
|
|
|
place.decision==1;
|
|
|
|
|
}
|
|
|
|
|
miseajouratt(place.suivant, nbplace-1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void miseajourindep(Maillonatt lplace, int nbplace, listetuinfo etu){
|
|
|
|
|
lpace = miseajourfile(lplace, nbplace, etu);
|
|
|
|
|
miseajouratt(lplace, nbplace);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// coté dep=============================================================================================================
|
|
|
|
|
// affichage dep
|
|
|
|
|
|
|
|
|
|
void affichageonlyadmis(Maillonatt etuatt){
|
|
|
|
|
if(etuatt==NULL){return;}
|
|
|
|
|
if(etuatt.decision==1){
|
|
|
|
|
printf("%d %s %s\n" etuatt.numc, etuatt.nom, etuatt.prenom);
|
|
|
|
|
}
|
|
|
|
|
affichageonlyadmis(etuatt.suivant);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void affichageonlyatt(Maillonatt etuatt){
|
|
|
|
|
if(etuatt==NULL){return;}
|
|
|
|
|
if(etuatt.decision==1){
|
|
|
|
|
printf("%d %s %s\n" etuatt.numc, etuatt.nom, etuatt.prenom);
|
|
|
|
|
}
|
|
|
|
|
affichageonlyatt(etuatt.suivant);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//chercher present en admission ========================================================================================
|
|
|
|
|
|
|
|
|
|
void chercheretuadmisindep(char choixnom[], char nomprenom[], Maillonatt etuatt){
|
|
|
|
|
if(etuatt==NULL){printf("erreur de recherche\n");return;}
|
|
|
|
|
if(strcmp(etuatt.nom,choixnom)==0){
|
|
|
|
|
if(strcmp(etuatt.prenom,choixprenom)==0){
|
|
|
|
|
if(etuatt.decision==1){printf("%s %s est admis\n", etuatt.nom, etuatt.prenom);return;}
|
|
|
|
|
if(etuatt.decision==2){printf("%s %s est en attente\n", etuatt.nom, etuatt.prenom);return;}
|
|
|
|
|
if(etuatt.decision==-1){printf("%s %s est refusé\n", etuatt.nom, etuatt.prenom);return;}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
chercheretuadmisindep(choixnom, choixprenom, etuatt.suivant);
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
// Général (menu et ce qui en ai relié)
|
|
|
|
|
/*
|
|
|
|
|
questionadmin(){
|
|
|
|
|
printf("\nQuel numéro détudiant ?\n==>");
|
|
|
|
|
scanf("%d%*c", &choix);
|
|
|
|
|
printf("\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int menu(void){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//charger
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int i=0, choix;
|
|
|
|
|
while(i!=1){
|
|
|
|
|
printf("\n\tmenu\n\n");
|
|
|
|
|
printf("1\tutilisateur\n");
|
|
|
|
|
printf("2\tadmin\n");
|
|
|
|
|
printf("3\tresponsable d'admission\n");
|
|
|
|
|
printf("\nQuel est votre choix ?\n==>");
|
|
|
|
|
scanf("%d%*c", &choix);
|
|
|
|
|
printf("\n");
|
|
|
|
|
if(choix==1){
|
|
|
|
|
}
|
|
|
|
|
if(choix==2){
|
|
|
|
|
}
|
|
|
|
|
if(choix==3){
|
|
|
|
|
}
|
|
|
|
|
if(choix<1 || choix>6){
|
|
|
|
|
printf("mauvaise saisie\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//enregister
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
*/
|