ajout rechercheDept et insererDept(compilent pas) 15/12 14h28

master
Maël DAIM 2 years ago
parent 38f86f0914
commit d37f972a8e

@ -1,5 +1,7 @@
#include "Msae.h" #include "Msae.h"
//################ fonction commune ###################################
void clearpage(void) void clearpage(void)
{ {
char entre; char entre;
@ -8,6 +10,7 @@ void clearpage(void)
system("clear"); system("clear");
} }
int login(void) int login(void)
{ {
int i=3; int i=3;
@ -50,3 +53,52 @@ int login(void)
else return 0; else return 0;
system("clear"); system("clear");
} }
//################# fonctions affichage ###########################
void afficherPlace(MaillonDept m)
{
printf("\nPour ce département il y a %d places en 1ère année \n\n",m.nbP);
}
//################## fonctions insertion #########################
int insererDept(VilleIUT v, MaillonDept m)
{
int trouve;
MaillonDept *pos;
pos=rechercheDept(v.lDept,&trouve,m.dept);
if(trouve==0)
{
printf("\nDépartement déjà présent dans cet IUT\n")
return -1;
}
m->suiv=pos;
pos=&m;
return 1;
}
//################# fonctions recherche #########################
MaillonDept* rechercheDept(ListeDept lDept, int *trouve, char nom[])
{
while(lDept->suiv!=NULL)
{
if(strcmp(nom,lDept->dept)==0)
{
*trouve=1;
return lDept;
}
if(strcmp(nom,lDept->dept)<0)
{
*trouve=0;
return lDept;
}
lDept=lDept->suiv;
}
*trouve=0;
return lDept;
}

@ -14,6 +14,7 @@ typedef struct maillonDept
}MaillonDept,*ListeDept; }MaillonDept,*ListeDept;
typedef struct typedef struct
{ {
char nom[31]; char nom[31];
@ -25,3 +26,16 @@ typedef struct
int login(void); int login(void);
void globale(void); void globale(void);
void clearpage(void); void clearpage(void);
//########## fonction affichage ##############
void afficherPlace(MaillonDept m);
//########## fonction admin #################
int insererDept(VilleIUT v, MaillonDept m);
//######### fonction recherche ##############
MaillonDept* rechercheDept(ListeDept lDept, int *trouve, char nom[ ] );

@ -2,8 +2,5 @@
int main(void) int main(void)
{ {
int a;
a=login();
printf("%d\n",a);
return 0; return 0;
} }
Loading…
Cancel
Save