From 7450b610cb65ee4adbecd5be73db417a888567af Mon Sep 17 00:00:00 2001 From: Lukian Date: Sun, 12 Nov 2023 21:36:26 +0100 Subject: [PATCH] commit --- conf.c | 43 +++++++++++++++++++++++++------------- conf.h | 21 ++++++++----------- main | Bin 16216 -> 16224 bytes main.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 100 insertions(+), 29 deletions(-) diff --git a/conf.c b/conf.c index 4652498..438b0ba 100644 --- a/conf.c +++ b/conf.c @@ -3,20 +3,6 @@ #include #include "conf.h" -ptDate newDate(int day, int month, int year) { - ptDate date = (ptDate) malloc(sizeof(ptDate)); - - date -> day = day; - date -> month = month; - date -> year = year; - - return date; -} - -void printDate(ptDate date) { - printf("date : %d/%d/%d\n", date -> day, date -> month, date -> year); -} - ptConf newConfChain() { ptConf confChain = (ptConf) malloc(sizeof(ptConf)); @@ -32,10 +18,37 @@ void addConf(ptConf confChainStart, char title[], char speaker[], int day, int m px = px -> next; } - px -> date = newDate(day, month, year); + px -> day = day; + px -> month = month; + px -> year = year; strcpy(px -> title, title); strcpy(px -> speaker, speaker); // ajouter le builder de liste de participants px -> next = (ptConf) malloc(sizeof(ptConf)); px -> next -> next = NULL; +} + +ptListener newListenerChain() { + ptListener listenerChain = (ptListener) malloc(sizeof(ptListener)); + + listenerChain -> prev = NULL; + listenerChain -> next = NULL; + + return listenerChain; +} + +void addListener(ptListener listenerChain, char name[], int age, int level) { + ptListener px = listenerChain; + + while (px -> next != NULL) { + px = px -> next; + } + + strcpy(px -> name, name); + px -> age = age; + px -> level = level; + // ajouter la liste de conférences + px -> next = (ptListener) malloc(sizeof(ptListener)); + px -> next -> next = NULL; + px -> next -> prev = px; } \ No newline at end of file diff --git a/conf.h b/conf.h index b7d0b8e..02e7907 100644 --- a/conf.h +++ b/conf.h @@ -1,18 +1,15 @@ #ifndef CONF_H #define CONF_H -typedef struct date { - int day; - int month; - int year; -} tDate; - struct listenerList; typedef struct conf { - tDate *date; + struct date* date; char title[30]; char speaker[20]; + int day; + int month; + int year; struct listenerList* listeners; struct conf* next; } tConf; @@ -26,8 +23,9 @@ typedef struct listener { char name[20]; int age; int level; - struct tConfList* confs; - struct tListener* next; + struct confList* confs; + struct listener* prev; + struct listener* next; } tListener; typedef struct listenerList { @@ -35,15 +33,14 @@ typedef struct listenerList { struct tListenerList* next; } tListenerList; -typedef tDate* ptDate; typedef tConf* ptConf; typedef tListener* ptListener; typedef tConfList* ptConfList; typedef tListenerList* ptListenerList; -ptDate newDate(int day, int month, int year); -void printDate(ptDate date); ptConf newConfChain(); void addConf(ptConf confChainStart, char title[], char speaker[], int day, int month, int year); +ptListener newListenerChain(); +void addListener(ptListener listenerChain, char name[], int age, int level); #endif // CONF_H \ No newline at end of file diff --git a/main b/main index 47276e7e8b8ffd8d889e499b34cb20eb254ab322..6dc356ceed25397fb11f73d00ad093cc6da6c75e 100644 GIT binary patch delta 1367 zcmaJ>ZAep57(VAtn={i*CuMHF7uf zV%e<^FXS#=S}Go;S50~C!%!p!ys`58V|s+j`&wXsKa(YcnOUg}3akuBc)a^R(#d&T z`iTKZ+cc?2yi*fy=szU}rR5wu2a-hcL<}Z|nRW{a_kk9TullJdoDX;;RuzxW3^WgL z$>5`zv_;>1B6%-%el$KvVpWN(ig;t7j)`H9M0?WLwX=FP!+Jse7^4He5h9hU(K8}> z)M$uE8+dV0N&<{BYvlQO%@6J-rn!!2=`u*GgSRmOdB{tNBynWZz(WB$&&7YaUCfK( zZtYCSE5jZKIL~Z%h@@>?B+XIcdr7Jyz`@QNn@G|610O$`BYrY5-~->I?B0XlRo?-q zm&~jx;ENDxzH0gcW8fjJp|KtS<0{K*ikV3n2iv)*R zew%wwhr8(&XC=1NH_jdSI4yP+8g8VsGKBhRt1Aa|^rmZNZaOj|nxPWBEriW5#)zy4 zdDQ&u?`gWkWwBlY)+AU_(qHT~YI0lf9a`{xpn%aOvUPPm|>{Uv$H4zoHF?sU3jBV2lMX};n2pWo5aLPLj5m2}9xrIi9Mp&jRCDS2@W;033l6tp zb^a9eBZDA92)P*kwHQID9T#2U@$d=66^M!bFaGSaL;|td7kGz?|a@|_9^@> z99@Yoo?rDbD`Y@?gbXwnR~YYMZF^7Ig6-Ji61D9tQX(YtcXmxBr_-19UJS;=zVFM* zwk;5Lr6Q7mAW3feDV_C{ay&7VDUm1A*>sx;6!P>AJ2fujEgq| z$AxDPf8;Ek@=D~ZbRr>=P=Xwa6L0K6CJSn3K?Kf*^JQ;>n6*Wmc+#|0j6^({Z28YI zW{HHf7>SFrZb!VV8w*m(n*6P*(SL)r)Cmw~QcF+W61&8IiQE#QH*-rP(yUWy$WcpmU>>xF!vCT z#E~V^%Ze)H`LDC-m3c!K#Fg!Bt-(FwdT~XYoj+NuaJ<-1=K(arj3rg|Bw)#ys`dfa z06qe21KbbTJg%zm0Y?C*0T)iF>Js=+wgS2U!+^Um4U5GEV{lX{SWshznL!E68kjri zplHJZIx1Qtd%;u5M13p)JOi@>(j8}9lgWHqXjm{$=$W4ZKRVM{SpR_5-PYp$`I-{-TL&dcAy|5Xe(Lm)|zvJM>c3 zX6&M)Ron4CTI+Bc@8+^Fga&Aj!v;Qj)lo)cj(mKW7CEf=6tz@a3obwk3j(Ley(mos z)Jt0&)`DB0no%KIyWh(L$yDzXB3 rS}thaRNW?AOE title, confChain -> speaker); - printDate(confChain -> date); + //addListener(listenerChain, "Roger", 19, 4); + ptConf px = confChain; + + while (px -> next != NULL) { + printf("title : %s\nspeaker : %s\n", px -> title, px -> speaker); + 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; + } + } + + return 0; } \ No newline at end of file