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

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

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

Loading…
Cancel
Save