diff --git a/Msae.c b/Msae.c index 236b52e..e0b30b9 100644 --- a/Msae.c +++ b/Msae.c @@ -1,5 +1,7 @@ #include "Msae.h" +//################ fonction commune ################################### + void clearpage(void) { char entre; @@ -8,6 +10,7 @@ void clearpage(void) system("clear"); } + int login(void) { int i=3; @@ -50,3 +53,52 @@ int login(void) else return 0; 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; +} + diff --git a/Msae.h b/Msae.h index 15eb7c5..206698b 100644 --- a/Msae.h +++ b/Msae.h @@ -14,6 +14,7 @@ typedef struct maillonDept }MaillonDept,*ListeDept; + typedef struct { char nom[31]; @@ -25,3 +26,16 @@ typedef struct int login(void); void globale(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[ ] ); + diff --git a/Mtest.c b/Mtest.c index d52874d..42d6b55 100644 --- a/Mtest.c +++ b/Mtest.c @@ -2,8 +2,5 @@ int main(void) { - int a; - a=login(); - printf("%d\n",a); return 0; -} \ No newline at end of file +}