@ -4,23 +4,34 @@
# include "iut.h"
void MenuAdministrateur ( VilleIUT * tiut [ ] , int n ) {
char departement [ 30 ] , respon [ 30 ] ;
int choix , nbp ;
char departement [ 30 ] , respon [ 30 ] ,Vmodif [ 31 ] ;
int choix , nbp ,i , comp ;
VilleIUT V ;
printf ( " \n 1-Modifier place \n 2-Creer un departement \n 3-supprimer un département \n 4-Lancer et Arreter la phase de canditature \n 5-modifier nom responsable " ) ;
scanf ( " %d " , & choix ) ;
if ( choix = = 1 ) {
//modification nbP
}
if ( choix = = 2 ) {
//creer departemement
printf ( " \n departement : " ) ;
printf ( " \n Ville où se situe le departement " ) ;
scanf ( " %s " , Vmodif ) ;
printf ( " \n departement a creer : " ) ;
scanf ( " %s " , departement ) ;
printf ( " \n nombre de place : " ) ;
scanf ( " %d " , & nbp ) ;
printf ( " \n responsable :" ) ;
printf ( " \n nom 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 ) {
@ -59,27 +70,31 @@ ListeD suppression(ListeD ld,char *departement,char *responsable){
}
/*
VilleIUT Enfiler ( VilleIUT V , char * departement , int nbP , char * resp ) {
MaillonDept * m ;
m = ( MaillonDept * ) malloc ( sizeof ( MaillonDept ) ) ;
if ( m = = NULL ) { printf ( " pb ouv malloc " ) ; exit ( 1 ) ; }
strcpy ( m - > departement , departement ) ;
m - > nbP = nbP ;
strcpy ( m - > resp , resp ) ;
m - > suivant = NULL ;
if ( testVide ( V ) ) {
V . Ville = m ;
V . Idept = m ;
}
else {
V . Idept - > suivant = m ;
V . Idept = m ;
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 V ;
return ld ;
}
/*
VilleIUT defiler ( VilleIUT V ) {
MaillonDept * temp ;
if ( testVide ( V ) ) {