Ajout de la fonction existeDep() permettant de vérifier l'existence d'un département dans la base de données.

master
Yann CHAMPEAU 3 years ago
parent bedf439008
commit 4a3855a624

@ -1,6 +0,0 @@
{
"files.associations": {
"saep2.h": "c",
"saeannexe.h": "c"
}
}

@ -1,6 +1,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <errno.h> #include <errno.h>
#include <string.h>
#include "../partie1/saeP1.h" #include "../partie1/saeP1.h"
#include "saeAnnexe.h" #include "saeAnnexe.h"
@ -69,8 +70,14 @@ int rechercheTabPtVilleIUT(VilleIUT* tab[],int lTab,char* mot){
} }
//Listes chainées //Listes chainées
int existe(MaillonDep* liste, char* mot){ int existeDep(MaillonDep* liste, char* dep){
return 1;//A Faire ! MaillonDep* m=liste;
while(m->suivant!=NULL){
if(!strcmp(m->departement,dep)){
return 1;
}
}
return 0;
} }
int recherche(MaillonDep* liste, char* mot){ int recherche(MaillonDep* liste, char* mot){

@ -25,49 +25,49 @@ typedef struct file* File; // //
//Initialisation de fonctions : ------------------------// //Initialisation de fonctions : --------------------------------//
// //
void menu(void); // void menu(void); //
// //
int loadIUT(VilleIUT** tiut); //Fichier Binaire. // int loadIUT(VilleIUT** tiut); //Fichier Binaire. //
// //
int rechercheTabPtVilleIUT(VilleIUT* tab[],int lTab,char* mot); ///////////////////////////////////// N O N //////////////////////////// int rechercheTabPtVilleIUT(VilleIUT* tab[],int lTab,char* mot); //
// //
// //
// //
//Fonctions relatives aux listes chaînées : --// // //Fonctions relatives aux listes chaînées : --// //
int existe(MaillonDep* liste, char* mot); // // int existeDep(MaillonDep* liste, char* dep); // //
// // // //
int recherche(MaillonDep* liste, char* mot); // // int recherche(MaillonDep* liste, char* mot); // //
//--------------------------------------------// // //--------------------------------------------// //
// //
// //
// //
//Fonctions relatives aux piles : --// // //Fonctions relatives aux piles : --// //
Pile creerpile(int tmax); // // Pile creerpile(int tmax); // //
// // // //
void empiler(Pile p, int x); // // void empiler(Pile p, int x); // //
// // // //
void afficherPileEntier(Pile p); // // void afficherPileEntier(Pile p); // //
// // // //
int depiler(Pile p); // // int depiler(Pile p); // //
//----------------------------------// // //----------------------------------// //
// //
// //
// //
//Fonctions relatives aux files : --// // //Fonctions relatives aux files : --// //
File creerfile(int tmax); // // File creerfile(int tmax); // //
// // // //
void enfiler(File f, int x); // // void enfiler(File f, int x); // //
// // // //
void afficherFileEntier(File f); // // void afficherFileEntier(File f); // //
// // // //
int defiler(File f); // // int defiler(File f); // //
// // // //
void vider_file(File f); // // void vider_file(File f); // //
//----------------------------------// // //----------------------------------// //
// //
// //
// //
void reset(void); // void reset(void); //
//------------------------------------------------------// //--------------------------------------------------------------//

@ -167,7 +167,7 @@ void modifPlaces(VilleIUT* tiut[],int tlogi){
printf("\n\nEntrez le département à modifier:"); printf("\n\nEntrez le département à modifier:");
char dep[31]; char dep[31];
scanf("%*c%s",&dep); scanf("%*c%s",&dep);
if(!existe(tiut->ldept,dep)){ if(!existeDep(tiut->ldept,dep)){
fprintf(stderr,"\nDépartement non existant !\n"); fprintf(stderr,"\nDépartement non existant !\n");
return; return;
} }
@ -228,7 +228,7 @@ void supprimerDep(VilleIUT* tiut[],int tlogi){
printf("\n\nEntrez le département à supprimer:"); printf("\n\nEntrez le département à supprimer:");
char dep[31]; char dep[31];
scanf("%*c%s",&dep); scanf("%*c%s",&dep);
if(!existe(tiut->ldept,dep)){ if(!existeDep(tiut->ldept,dep)){
fprintf(stderr,"\nDépartement non existant !\n"); fprintf(stderr,"\nDépartement non existant !\n");
return; return;
} }
@ -268,7 +268,7 @@ void modifNomResponsable(VilleIUT* tiut[],int tlogi){
printf("\n\nEntrez le département à modifier:"); printf("\n\nEntrez le département à modifier:");
char dep[31]; char dep[31];
scanf("%*c%s",&dep); scanf("%*c%s",&dep);
if(!existe(tiut->ldept,dep)){ if(!existeDep(tiut->ldept,dep)){
fprintf(stderr,"\nDépartement non existant !\n"); fprintf(stderr,"\nDépartement non existant !\n");
return; return;
} }

Loading…
Cancel
Save