commit
This commit is contained in:
parent
aa5045a797
commit
dec244496a
10 changed files with 148 additions and 76 deletions
102
conf.c
102
conf.c
|
@ -4,79 +4,83 @@
|
|||
#include "conf.h"
|
||||
|
||||
int findConfId(ptConf confChain) {
|
||||
ptConf px = confChain;
|
||||
int max = 0;
|
||||
ptConf px = confChain;
|
||||
int max = 0;
|
||||
|
||||
while (px -> next != NULL) {
|
||||
if (px -> id > max) {
|
||||
max = px -> id;
|
||||
}
|
||||
}
|
||||
while (px -> next != NULL) {
|
||||
if (px -> id > max) {
|
||||
max = px -> id;
|
||||
}
|
||||
|
||||
px = px -> next;
|
||||
}
|
||||
|
||||
return max + 1;
|
||||
return max + 1;
|
||||
}
|
||||
|
||||
ptConf newConfChain() {
|
||||
ptConf confChain = (ptConf) malloc(sizeof(tConf));
|
||||
ptConf confChain = (ptConf) malloc(sizeof(tConf));
|
||||
|
||||
confChain -> next = NULL;
|
||||
confChain -> next = NULL;
|
||||
|
||||
return confChain;
|
||||
return confChain;
|
||||
}
|
||||
|
||||
void addConf(ptConf confChain, char title[], char speaker[], int day, int month, int year) {
|
||||
ptConf px = confChain;
|
||||
ptConf px = confChain;
|
||||
|
||||
while (px -> next != NULL) {
|
||||
px = px -> next;
|
||||
}
|
||||
while (px -> next != NULL) {
|
||||
px = px -> next;
|
||||
}
|
||||
|
||||
px -> id = findConfId(confChain);
|
||||
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(tConf));
|
||||
px -> next -> next = NULL;
|
||||
px -> id = findConfId(confChain);
|
||||
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(tConf));
|
||||
px -> next -> next = NULL;
|
||||
}
|
||||
|
||||
int findListenerId(ptListener listenerChain) {
|
||||
ptListener px = listenerChain;
|
||||
int max = 0;
|
||||
ptListener px = listenerChain;
|
||||
int max = 0;
|
||||
|
||||
while (px -> next != NULL) {
|
||||
if (px -> id > max) {
|
||||
max = px -> id;
|
||||
}
|
||||
}
|
||||
while (px -> next != NULL) {
|
||||
if (px -> id > max) {
|
||||
max = px -> id;
|
||||
}
|
||||
|
||||
px = px -> next;
|
||||
}
|
||||
|
||||
return max + 1;
|
||||
return max + 1;
|
||||
}
|
||||
|
||||
ptListener newListenerChain() {
|
||||
ptListener listenerChain = (ptListener) malloc(sizeof(tListener));
|
||||
ptListener listenerChain = (ptListener) malloc(sizeof(tListener));
|
||||
|
||||
listenerChain -> prev = NULL;
|
||||
listenerChain -> next = NULL;
|
||||
listenerChain -> prev = NULL;
|
||||
listenerChain -> next = NULL;
|
||||
|
||||
return listenerChain;
|
||||
return listenerChain;
|
||||
}
|
||||
|
||||
void addListener(ptListener listenerChain, char name[], int age, int level) {
|
||||
ptListener px = listenerChain;
|
||||
ptListener px = listenerChain;
|
||||
|
||||
while (px -> next != NULL) {
|
||||
px = px -> next;
|
||||
}
|
||||
while (px -> next != NULL) {
|
||||
px = px -> next;
|
||||
}
|
||||
|
||||
px -> id = findListenerId(listenerChain);
|
||||
strcpy(px -> name, name);
|
||||
px -> age = age;
|
||||
px -> level = level;
|
||||
// ajouter la liste de conférences
|
||||
px -> next = (ptListener) malloc(sizeof(tListener));
|
||||
px -> next -> next = NULL;
|
||||
px -> next -> prev = px;
|
||||
}
|
||||
px -> id = findListenerId(listenerChain);
|
||||
strcpy(px -> name, name);
|
||||
px -> age = age;
|
||||
px -> level = level;
|
||||
// ajouter la liste de conférences
|
||||
px -> next = (ptListener) malloc(sizeof(tListener));
|
||||
px -> next -> next = NULL;
|
||||
px -> next -> prev = px;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue