diff --git a/conf.c b/conf.c index 438b0ba..a10e903 100644 --- a/conf.c +++ b/conf.c @@ -4,7 +4,7 @@ #include "conf.h" ptConf newConfChain() { - ptConf confChain = (ptConf) malloc(sizeof(ptConf)); + ptConf confChain = (ptConf) malloc(sizeof(tConf)); confChain -> next = NULL; @@ -24,12 +24,12 @@ void addConf(ptConf confChainStart, char title[], char speaker[], int day, int m strcpy(px -> title, title); strcpy(px -> speaker, speaker); // ajouter le builder de liste de participants - px -> next = (ptConf) malloc(sizeof(ptConf)); + px -> next = (ptConf) malloc(sizeof(tConf)); px -> next -> next = NULL; } ptListener newListenerChain() { - ptListener listenerChain = (ptListener) malloc(sizeof(ptListener)); + ptListener listenerChain = (ptListener) malloc(sizeof(tListener)); listenerChain -> prev = NULL; listenerChain -> next = NULL; @@ -48,7 +48,7 @@ void addListener(ptListener listenerChain, char name[], int age, int level) { px -> age = age; px -> level = level; // ajouter la liste de conférences - px -> next = (ptListener) malloc(sizeof(ptListener)); + px -> next = (ptListener) malloc(sizeof(tListener)); px -> next -> next = NULL; px -> next -> prev = px; -} \ No newline at end of file +} diff --git a/conf.h b/conf.h index 02e7907..c33ec37 100644 --- a/conf.h +++ b/conf.h @@ -4,7 +4,6 @@ struct listenerList; typedef struct conf { - struct date* date; char title[30]; char speaker[20]; int day; @@ -15,8 +14,8 @@ typedef struct conf { } tConf; typedef struct confList { - struct tConf* conf; - struct tConfList* next; + struct conf* conf; + struct confList* next; } tConfList; typedef struct listener { @@ -29,8 +28,8 @@ typedef struct listener { } tListener; typedef struct listenerList { - struct tListener* listener; - struct tListenerList* next; + struct listener* listener; + struct listenerList* next; } tListenerList; typedef tConf* ptConf; @@ -43,4 +42,4 @@ void addConf(ptConf confChainStart, char title[], char speaker[], int day, int m ptListener newListenerChain(); void addListener(ptListener listenerChain, char name[], int age, int level); -#endif // CONF_H \ No newline at end of file +#endif // CONF_H diff --git a/main b/main index 6dc356c..97da3f9 100644 Binary files a/main and b/main differ diff --git a/main.c b/main.c index 89f8a0a..c407021 100644 --- a/main.c +++ b/main.c @@ -1,6 +1,7 @@ #include #include #include "conf.h" +#include "screenManager.h" int main() { @@ -11,66 +12,23 @@ int main() addConf(confChain, "test", "tesst", 21, 120, 2023); addConf(confChain, "test", "tesst", 21, 120, 2023); - //addListener(listenerChain, "Roger", 19, 4); + addListener(listenerChain, "Roger", 19, 4); ptConf px = confChain; + ptListener py = listenerChain; while (px -> next != NULL) { printf("title : %s\nspeaker : %s\n", px -> title, px -> speaker); + printf("%d/%d/%d\n", px -> day, px -> month, px -> year); px = px -> next; } - int i=0,j=0; - - ////////////////////////// Menu 1 //////////////////////////////// - - printf("\n 1/ Gestion des conferences\n 2/ Gestion des abonnes\n 3/ Participer a une conference"); - printf("\n 4/ Voir la meilleure conference\n 5/ Voir la participation a une conference"); - printf("\n 6/ Quitter\n"); - - - scanf("%d",&i); - - ////////////////////////////////////////////////////////////////// - - switch (i){ - - //////////////////////// Menu conf ///////////////////////// - - case 1:{ - printf("\n 1/ Voir la liste des conferences\n 2/ Ajouter une conference \n 3/ Suprimer une conference\n 4/ Retour\n"); - break; - } - - /////////////////////// Menu abonne ///////////////////////// - - case 2: { - printf("\n 1/ Voir la liste des abonnes\n 2/ Ajouter un abonne \n 3/ Suprimer un abonne\n 4/ Retour\n"); - break; - } - - case 3: { - printf("\n Nom de l'abonne : \n Nom de la conference : \n Note de la conference : "); - break; - } - - case 4: { - printf("\n Nom : \n Note : "); - break; - } - - - case 5: { - printf("\n Entrer le nom de la conference : "); - break; - } - - case 6: { - return 0; - break; - } + while (py -> next != NULL) { + printf("name: %s\nage: %d\nlevel: %d", py -> name, py -> age, py -> level); + py = py -> next; } - + + menu(); return 0; -} \ No newline at end of file +} diff --git a/main.exe b/main.exe new file mode 100644 index 0000000..b06c1d2 Binary files /dev/null and b/main.exe differ diff --git a/screenManager.c b/screenManager.c new file mode 100644 index 0000000..d6d70cd --- /dev/null +++ b/screenManager.c @@ -0,0 +1,55 @@ +#include +#include +#include "screenManager.h" + +void menu() { + int i=0; + + ////////////////////////// Menu 1 //////////////////////////////// + + printf("\n 1/ Gestion des conferences\n 2/ Gestion des abonnes\n 3/ Participer a une conference"); + printf("\n 4/ Voir la meilleure conference\n 5/ Voir la participation a une conference"); + printf("\n 6/ Quitter\n"); + + + scanf("%d",&i); + + ////////////////////////////////////////////////////////////////// + + switch (i){ + + //////////////////////// Menu conf ///////////////////////// + + case 1:{ + printf("\n 1/ Voir la liste des conferences\n 2/ Ajouter une conference \n 3/ Suprimer une conference\n 4/ Retour\n"); + break; + } + + /////////////////////// Menu abonne ///////////////////////// + + case 2: { + printf("\n 1/ Voir la liste des abonnes\n 2/ Ajouter un abonne \n 3/ Suprimer un abonne\n 4/ Retour\n"); + break; + } + + case 3: { + printf("\n Nom de l'abonne : \n Nom de la conference : \n Note de la conference : "); + break; + } + + case 4: { + printf("\n Nom : \n Note : "); + break; + } + + + case 5: { + printf("\n Entrer le nom de la conference : "); + break; + } + + case 6: { + break; + } + } +} diff --git a/screenManager.h b/screenManager.h new file mode 100644 index 0000000..9036efc --- /dev/null +++ b/screenManager.h @@ -0,0 +1,6 @@ +#ifndef SREEN_MANAGER_H +#define SREEN_MANAGER_H + +void menu(); + +#endif // SCREEN_MANAGER