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.

111 lines
2.8 KiB

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "iut.h"
void MenuAdministrateur(VilleIUT *tiut[],int n){
char departement[30],respon[30],Vmodif[31];
int choix,nbp,i,comp;
VilleIUT V;
printf("\n1-Modifier place\n2-Creer un departement\n3-supprimer un département\n4-Lancer et Arreter la phase de canditature\n5-modifier nom responsable");
scanf("%d",&choix);
if(choix==1){
}
if(choix==2){
//creer departemement
printf("\nVille où se situe le departement");
scanf("%s",Vmodif);
printf("\ndepartement a creer :");
scanf("%s",departement);
printf("\nnombre de place :");
scanf("%d",&nbp);
printf("\nnom du responsable :");
scanf("%s",respon);
for(i=0;i<n;i++){
comp=strcmp(tiut[i]->ville,Vmodif);
if(comp==0){
tiut[i]->ldept=Enfiler(tiut[i]->ldept,departement,nbp,respon);
}
if(comp<0)
printf("error impossible ville inexistante");
}
//V=Enfiler(V,departement,nbp,respon);
}
if(choix==3){
//supprimer departement et pauser condition pour choisir qui suppr
printf("\ndepartement :");
scanf("%s",departement);
printf("\nresponsable :");
scanf("%s",respon);
// *resultat=recherche(V.Ville,departement,respon);
//m=suppression(m,departement,respon);
affichage(tiut, n);
}
if(choix==4){
//Lancer et arreter phase de canditature
}
if(choix==5){
//modification responsable
}
}
ListeD suppressionTete(ListeD ld){
ListeD ldsvt;
ldsvt=ld->suivant;
free(ld);
return ldsvt;
}
ListeD suppression(ListeD ld,char *departement,char *responsable){
if(ld==NULL)
return ld;
if(strcmp(ld->departement,departement) ==0 && strcmp(ld->resp,responsable) ==0)
return suppressionTete(ld);
ld->suivant=suppression(ld->suivant,departement,responsable);
return ld;
}
ListeD Enfiler(ListeD ld, char departement[30], int nbP, char resp[30]) {
MaillonDept *mN;
mN = (MaillonDept*)malloc(sizeof(MaillonDept));
if(mN==NULL){printf("pb ouv malloc");exit(1);}
strcpy(mN->departement, departement);
mN->nbP = nbP;
strcpy(mN->resp, resp);
mN->suivant = NULL;
if (ld == NULL) {
ld = mN;
} else {
MaillonDept *mD;
mD = ld;
while (mD->suivant != NULL) {
mD = mD->suivant;
}
mD->suivant = mN;
}
return ld;
}
/*
VilleIUT defiler(VilleIUT V){
MaillonDept *temp;
if(testVide(V)){
printf("testVide");
return V;
}
temp=V.Ville;
V.Ville=temp->suivant;
free(temp);
if(V.Ville==NULL)
V.Idept=NULL;
return V;
}
*/