|
|
|
@ -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,89 +285,144 @@ 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
|
|
|
|
|
|
|
|
|
|
//chargement ======================================================================================================================================================================
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
|
|
Listchoixdept listvide(void){return NULL;}
|
|
|
|
|
|
|
|
|
|
Listchoixdept lireCarte(FILE *fe, int nbchoix){
|
|
|
|
@ -406,6 +463,8 @@ int chargeretudiant(char nomFich[], listetuinfo *tetu[], int tmax){
|
|
|
|
|
return nbetu;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
//enregistrement ========================================================================================================================================================
|
|
|
|
|
|
|
|
|
|
void enregistrementcarte(FILE *fe, Maillonchoix* carte, int nb){
|
|
|
|
@ -666,7 +725,7 @@ void affichageetu(listetuinfo etu){
|
|
|
|
|
printf(" matière spé : %d\n", a.notes[3]);
|
|
|
|
|
affichagecarteall(lcarte);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
void affichage(Listchoixdept c){
|
|
|
|
|
if(c==NULL){printf("\n");return;}
|
|
|
|
|
printf("%s %s %d %d", c->Ville, c->dep, c->decision, c->validation);
|
|
|
|
@ -677,6 +736,7 @@ void affichage(Listchoixdept c){
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//affiche que la personne
|
|
|
|
|
void affichageetu(listetuinfo a){
|
|
|
|
|
printf(" %d\n %s %s\n", a.numeroetu, a.nometu, a.prenometu);
|
|
|
|
@ -712,45 +772,81 @@ void test1(void){
|
|
|
|
|
nb = chargeretudiant(nomFich, tetu, 5000);
|
|
|
|
|
affichealletu(tetu, nb);
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
//==========================================================================================================
|
|
|
|
|
|
|
|
|
|
//==========================================================================================================
|
|
|
|
|
*/
|
|
|
|
|
// Partie 3
|
|
|
|
|
|
|
|
|
|
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" à 0
|
|
|
|
|
if (departementVille->etudiants[i]->moyenne < 10) departementVille->etudiants[i]->carte->decision = 0;
|
|
|
|
|
// 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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Partie 4
|
|
|
|
|
|
|
|
|
@ -767,7 +863,7 @@ void test1(void){
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// coté etu=========================================================================================================
|
|
|
|
|
// affichage
|
|
|
|
@ -914,3 +1010,4 @@ int menu(void){
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|