Creation fonction de modification pour les candidat

master
Benjamin BACHELARD 2 years ago
parent 21612cbedd
commit 5abc716feb

@ -97,18 +97,59 @@ int chargementcandidat(Candidat *tcandidat[],int tmax){
}
// Menu Candidat
void MenuCandidat(Candidat *tcandidat[],VilleIUT *tiut[],int nc){
int Achoix, choix, i, j, comp, comp1;
char Ncandidat[30], PNcandidat[30], departement[30];
int Achoix, choix, i, j, comp, comp1, numero, place;
char Ncandidat[30], PNcandidat[30], departement[30], newdepart[30], Vmodif[30], Ville[30];
printf("\n0-Revenir au menu\t1-Etudiant\t2-departement\n:");
scanf("\n%d",&Achoix);
while(Achoix>0 && Achoix<3){
if(Achoix==1){
// a toi nicolas
printf("\n\nVeuillez saisir votre numero de Candidat(si revenir au menu - 0)\n:");
scanf("%d",&numero);
if(numero==0){
Achoix=0;
break;
}
place=verificationid(tcandidat, numero, nc);
if(place==-1){
printf("pb numero inconnu");
exit(1);
}
printf("\nVos choix\n");
affichageListeCandidatchoix(tcandidat[place]->lchoix);
printf("\n0-Revenir au menu\n1-modifier\n2-ajouter\n3-supprimer\n:");
scanf("%d",&choix);
while(choix>0){
if(choix==1){
printf("\nVille où voulez modifier : ");
scanf("%s",Ville);
printf("\nDepartement lier : ");
scanf("%s",departement);
printf("\nNouvelle Ville : ");
scanf("%s",Vmodif);
printf("\nNouveau Departement lier : ");
scanf("%s",newdepart);
tcandidat[place]->lchoix=modifCandidat(tcandidat[place]->lchoix, departement, newdepart, Ville, Vmodif, nc);
affichageListeCandidatchoix(tcandidat[place]->lchoix);
printf("\n0-Revenir au menu\n1-modifier\n2-ajouter\n3-supprimer\n:");
scanf("%d",&choix);
}
if(choix==2){
}
if(choix==3){
}
}
}
if(Achoix==2){
printf("\n0-Revenir au menu\n1-Afficher Info pour un Candidat\n2-Afficher tout les Candidat par departement\n3-Afficher tout les Candidat avec leur information\n:");
scanf("\n%d",&choix);
while(choix>0 ){
if(choix==0){
Achoix=0;
break;
}
while(choix>0){
if(choix==1){
printf("\nnom du candidat:");
scanf("%s",Ncandidat);
@ -136,8 +177,12 @@ void MenuCandidat(Candidat *tcandidat[],VilleIUT *tiut[],int nc){
printf("\n\n\n\t\tTableau Candidat et choix\n");
affichageCandidatchoix(tcandidat,nc);
}
printf("\nVoulez-vous choisir une autre fonction ? Sinon taper 0 pour valider : ");
scanf("%d%*c",&choix);
printf("\nVoulez-vous choisir une autre fonction ? Sinon taper 0 pour valider : ");
scanf("%d%*c",&choix);
if(choix==0){
Achoix=0;
break;
}
}
}
}
@ -162,4 +207,25 @@ int rechercheCandidatParVille(ListeC ld,char *departement ,char *Ville, int nc){
ld = ld->suivant;
}
return-1;
}
}
int verificationid(Candidat *tcandidat[], int numero, int nc){
int i;
for(i=0;i<nc;i++){
if(tcandidat[i]->numero==numero)
return i;
}
return -1;
}
ListeC modifCandidat(ListeC ld, char *departement, char *newdepart, char *Ville, char *newVille, int n){
int comp, comp1, trouv, i;
for(i=0;i<=n;i++){
comp=strcmp(ld->departement,departement);
comp1=strcmp(ld->ville,Ville);
if(comp==0 && comp1==0){
strcpy(ld->departement, newdepart);
strcpy(ld->ville, newVille);
return ld;
}
ld=ld->suivant;
}
}

@ -6,15 +6,25 @@ Aurillac Informatique 0 0
Clermont Informatique 0 0
Grenoble Biologie 0 0
Aurillac Informatique 0 0
226584 deni martin 14 11.5 19 14 3
226574 deni martin 14 11.5 19 14 3
Clermont Biologie 0 0
Grenoble Informatique 0 0
Aurillac Informatique 0 0
226584 dadi kevin 20 17.5 19 19 3
226564 dadi kevin 20 17.5 19 19 3
Clermont Biologie 0 0
Grenoble Informatique 0 0
Aurillac Informatique 0 0
226584 moto biker 20 17.5 19 19 3
226354 moto biker 20 17.5 19 19 1
Clermont Informatique 0 0
226424 atom quantin 14 11.5 19 14 3
Clermont Biologie 0 0
Grenoble Informatique 0 0
Aurillac Informatique 0 0
226454 chahcha deni 20 17.5 19 19 3
Clermont Biologie 0 0
Grenoble Informatique 0 0
Aurillac Informatique 0 0
225584 antoin killer 20 17.5 19 19 3
Clermont Informatique 0 0
Grenoble Informatique 0 0
Aurillac Biologie 0 0

@ -5,7 +5,7 @@
void MenuAdministrateur(VilleIUT *tiut[],int n){
char departement[30], respon[30], Vmodif[31],tVille[31], tdepartemnt[30], AouD;
int choix, nbp, i, j, comp, Mnbp,good=0;
int choix, nbp, i, j, comp, Mnbp,good=0,reussi=0;
VilleIUT V;
printf("\n0-Revenir au menu\n1-Modifier place\n2-Creer un departement\n3-supprimer un département\n4-Lancer et Arreter la phase de canditature\n5-modifier nom responsable :");
@ -27,12 +27,15 @@ void MenuAdministrateur(VilleIUT *tiut[],int n){
}
}
if(good==0){
printf("\nnombre de place apres modification :");
scanf("%d",&Mnbp);
tiut[i]->ldept=ModifinbP(tiut[i]->ldept,departement,Mnbp,n);
printf("\nnombre de place apres modification :");
scanf("%d",&Mnbp);
tiut[i]->ldept=ModifinbP(tiut[i]->ldept,departement,Mnbp,n);
reussi=1;
}
}
}
if(reussi==0)
printf("pb erreur syntaxe\n");
}
if(choix==2){
//creer departemement
@ -49,8 +52,11 @@ void MenuAdministrateur(VilleIUT *tiut[],int n){
if(comp==0){
tiut[i]->ldept=Enfiler(tiut[i]->ldept,departement,nbp,respon);
tiut[i]->nbDep=tiut[i]->nbDep+1;
reussi=1;
}
}
if(reussi==0)
printf("pb erreur syntaxe\n");
}
if(choix==3){
//supprimer departement et pauser condition pour choisir qui suppr
@ -63,8 +69,11 @@ void MenuAdministrateur(VilleIUT *tiut[],int n){
if(comp==0){
tiut[i]->ldept=suppression(tiut[i]->ldept,departement);
tiut[i]->nbDep=tiut[i]->nbDep-1;
reussi=1;
}
}
if(reussi==0)
printf("pb erreur syntaxe\n");
}
if(choix==4){
//Lancer et arreter phase de canditature
@ -73,13 +82,16 @@ void MenuAdministrateur(VilleIUT *tiut[],int n){
printf("\ndepartement :");
scanf("%s",departement);
printf("\nPour Activer taper A pour desactiver taper D :");
scanf("%c",&AouD);
scanf("%c%*c",&AouD);
for(i=0;i<n;i++){
comp=strcmp(tiut[i]->ville, Vmodif);
if(comp==0){
tiut[i]->ldept=ModifiAouD(tiut[i]->ldept,departement,AouD,n);
reussi=1;
}
}
if(reussi==0)
printf("pb erreur syntaxe\n");
}
if(choix==5){
//modification responsable
@ -93,8 +105,11 @@ void MenuAdministrateur(VilleIUT *tiut[],int n){
comp=strcmp(tiut[i]->ville, Vmodif);
if(comp==0){
tiut[i]->ldept=ModifiRespon(tiut[i]->ldept,departement,respon,n);
reussi=1;
}
}
if(reussi==0)
printf("pb erreur syntaxe\n");
}
affichage(tiut, n);
printf("\nVoulez-vous choisir une autre fonction ? Sinon taper 0 pour valider : ");
@ -119,7 +134,7 @@ void MenuAdministrateur(VilleIUT *tiut[],int n){
return ld;
}
ListeD ModifinbP(ListeD ld, char departement[30], int MnbP, int n){
ListeD ModifinbP(ListeD ld, char *departement, int MnbP, int n){
int comp,trouv,i;
for(i=0;i<=n;i++){
comp=strcmp(ld->departement,departement);

@ -67,6 +67,8 @@ typedef enum {faux,vrai}Booleen;
void afficheCandidat(Candidat *tcandidat[], int i);
int rechercheCandidatParDeaprtement(ListeC ld,char *departement, int nc);
int rechercheCandidatParVille(ListeC ld, char *departement ,char *Ville, int nc);
int verificationid(Candidat *tcandidat[], int numero, int nc);
ListeC modifCandidat(ListeC ld, char *departement, char *newdepart, char *Ville, char *newVille, int n);
//Menu Responsable
void MenuRespon(Candidat *tcandidat[], VilleIUT *tiut[], int n,int nc);

@ -0,0 +1,67 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "iut.h"
void MenuRespon(Candidat *tcandidat[],VilleIUT *tiut[], int n, int nc){
int Achoix, choix, i, j, m, comp, comp1;
char Ncandidat[30], PNcandidat[30], departement[30],Ville[30];
printf("\nVille où se situe le departement \n:");
scanf("%s",Ville);
printf("\nVotre Departement\n:");
scanf("%s", departement);
for(i=0;i<nc;i++){
comp=strcmp(tiut[i]->ville, Ville);
if(comp==0){
for(j=0;j<=tiut[i]->nbDep;j++){
if(strcmp(tiut[i]->ldept->departement, departement) == 0 && tiut[i]->ldept->AouD == 'D'){
for(m=0;m<nc;m++){
if(rechercheCandidatParVille(tcandidat[m]->lchoix,departement,Ville, nc) ==0){
afficheCandidat(tcandidat, m);
}
}
}
tiut[i]->ldept=tiut[i]->ldept->suivant;
}
}
}
/*
while(Achoix>0 && Achoix<3){
if(Achoix==1){
// a toi nicolas
}
if(Achoix==2){
printf("\n0-Revenir au menu\n1-Afficher Info pour un Candidat\n2-Afficher tout les Candidat par departement\n3-Afficher tout les Candidat avec leur information\n:");
scanf("\n%d",&choix);
while(choix>0 ){
if(choix==1){
printf("\nnom du candidat:");
scanf("%s",Ncandidat);
printf("\nprenom du candidat:");
scanf("%s",PNcandidat);
for(i=0;i<nc;i++){
comp=strcmp(tcandidat[i]->nom, Ncandidat);
comp1=strcmp(tcandidat[i]->prenom, PNcandidat);
if(comp==0 && comp1==0){
afficheCandidat(tcandidat, i);
affichageListeCandidatchoix(tcandidat[i]->lchoix);
}
}
}
if(choix==2){
printf("\nnom du departement souhaiter :");
scanf("%s",departement);
}
if(choix==3){
printf("\n\n\n\t\tTableau Candidat et choix\n");
affichageCandidatchoix(tcandidat,nc);
}
printf("\nVoulez-vous choisir une autre fonction ? Sinon taper 0 pour valider : ");
scanf("%d%*c",&choix);
}
}
}*/
}

@ -16,10 +16,12 @@ int main(){
printf("\nNombre de candidat : %d\n",nc);
while(rootChoice==1){
system("cls"); // pour Windows
system("clear"); // pour Unix
system("clear"); // pour Unix
printf("\t\tTableau Ville et departement\n");
printf("\nNombre de villes : %d\n",n);
affichage(tiut,n);
printf("\n\n\n\t\tTableau Candidat et choix\n");
printf("\nNombre de candidat : %d\n",nc);
affichageCandidatchoix(tcandidat,nc);
printf("\n\nUtilisateur - 1\tAdministrateur - 2\tCandidat - 3\tResponsable - 4\tSauvegarder et quitter - 5\n:");
scanf("%d",&choix);

Loading…
Cancel
Save