diff --git a/header/sae.h b/header/sae.h index 5925cbd..945b049 100644 --- a/header/sae.h +++ b/header/sae.h @@ -125,6 +125,7 @@ int modifieRespDept(VilleIut *tVilleIut[], int nbVilles, char ville[], char nomD void afficheIUTDept(VilleIut* *villeIut, int nbVilles, char *nomDept); void afficheVillesIUT(VilleIut **villeIut, int nbVilles); void afficheNbPlacesDep(VilleIut *tVilleIut[], int nbVilles, char nomDept[]); +int existeVille( VilleIut * tIut[], char ville[], int nbvilles ); void menuAdmin(VilleIut **villeIut, int nbVilles); void afficherCandidat(Candidat candidat); diff --git a/source/sae.c b/source/sae.c index 8c1968b..5bfc45c 100644 --- a/source/sae.c +++ b/source/sae.c @@ -596,6 +596,18 @@ void afficheNbPlacesDep(VilleIut *tVilleIut[], int nbVilles, char nomDept[]) } } +int existeVille( VilleIut * tIut[], char ville[], int nbvilles ) +{ + int i = 0; + + //recherche de la ville + for( e = 0; i < nbvilles; i ++ ) + { + if ( strcmp( tIut[i] -> nom, ville ) == 0 ) return i; // ville trouvée... + } + return -1; +} + /** * Affiche et gère le menu administrateur. * @@ -660,6 +672,11 @@ void menuAdmin(VilleIut **villeIut, int nbVilles) } while (choix != 7); } + + + + + /* ================================================ Partie 2