commit
This commit is contained in:
parent
c71dcffdf6
commit
7450b610cb
4 changed files with 100 additions and 29 deletions
43
conf.c
43
conf.c
|
@ -3,20 +3,6 @@
|
|||
#include <string.h>
|
||||
#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;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue