This commit is contained in:
Lukian 2023-11-12 14:59:55 +01:00
parent 244151ff0e
commit c71dcffdf6
4 changed files with 57 additions and 6 deletions

25
conf.c
View file

@ -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;
}

31
conf.h
View file

@ -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

BIN
main

Binary file not shown.

7
main.c
View file

@ -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;
}