diff --git a/conf.c b/conf.c index 4c2891c..4652498 100644 --- a/conf.c +++ b/conf.c @@ -14,5 +14,28 @@ ptDate newDate(int day, int month, int year) { } void printDate(ptDate date) { - printf("%d/%d/%d\n", date -> day, date -> month, date -> year); + printf("date : %d/%d/%d\n", date -> day, date -> month, date -> year); +} + +ptConf newConfChain() { + ptConf confChain = (ptConf) malloc(sizeof(ptConf)); + + confChain -> next = NULL; + + return confChain; +} + +void addConf(ptConf confChainStart, char title[], char speaker[], int day, int month, int year) { + ptConf px = confChainStart; + + while (px -> next != NULL) { + px = px -> next; + } + + px -> date = newDate(day, month, 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; } \ No newline at end of file diff --git a/conf.h b/conf.h index ef572af..b7d0b8e 100644 --- a/conf.h +++ b/conf.h @@ -7,18 +7,43 @@ typedef struct date { int year; } tDate; +struct listenerList; + typedef struct conf { - tDate date; + tDate *date; char title[30]; char speaker[20]; - struct tConf* next; + struct listenerList* listeners; + struct conf* next; } tConf; +typedef struct confList { + struct tConf* conf; + struct tConfList* next; +} tConfList; + +typedef struct listener { + char name[20]; + int age; + int level; + struct tConfList* confs; + struct tListener* next; +} tListener; + +typedef struct listenerList { + struct tListener* listener; + 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); #endif // CONF_H \ No newline at end of file diff --git a/main b/main index 81ad83d..47276e7 100644 Binary files a/main and b/main differ diff --git a/main.c b/main.c index 90697d9..62255dd 100644 --- a/main.c +++ b/main.c @@ -4,9 +4,12 @@ int main() { - ptDate date = newDate(12,12,2023); + ptConf confChain = newConfChain(); - printDate(date); + addConf(confChain, "test", "tesst", 21, 120, 2023); + + printf("title : %s\nspeaker : %s\n", confChain -> title, confChain -> speaker); + printDate(confChain -> date); return 0; } \ No newline at end of file