commit
This commit is contained in:
parent
0c6cf142a4
commit
370856ec3d
9 changed files with 68 additions and 42 deletions
12
conf.c
12
conf.c
|
@ -26,20 +26,20 @@ ptConf newConfChain() {
|
||||||
return confChain;
|
return confChain;
|
||||||
}
|
}
|
||||||
|
|
||||||
void addConf(ptConf confChain, char title[], char speaker[], int day, int month, int year) {
|
void addConf(ptConf confChain, int id, char title[], char speaker[], int day, int month, int year) {
|
||||||
ptConf px = confChain;
|
ptConf px = confChain;
|
||||||
|
|
||||||
while (px -> next != NULL) {
|
while (px -> next != NULL) {
|
||||||
px = px -> next;
|
px = px -> next;
|
||||||
}
|
}
|
||||||
|
|
||||||
px -> id = findConfId(confChain);
|
px -> id = id;
|
||||||
px -> day = day;
|
px -> day = day;
|
||||||
px -> month = month;
|
px -> month = month;
|
||||||
px -> year = year;
|
px -> year = year;
|
||||||
strcpy(px -> title, title);
|
strcpy(px -> title, title);
|
||||||
strcpy(px -> speaker, speaker);
|
strcpy(px -> speaker, speaker);
|
||||||
// ajouter le builder de liste de participants
|
px -> listeners = (ptListenerList) malloc(sizeof(tListenerList));
|
||||||
px -> next = (ptConf) malloc(sizeof(tConf));
|
px -> next = (ptConf) malloc(sizeof(tConf));
|
||||||
px -> next -> next = NULL;
|
px -> next -> next = NULL;
|
||||||
}
|
}
|
||||||
|
@ -68,18 +68,18 @@ ptListener newListenerChain() {
|
||||||
return listenerChain;
|
return listenerChain;
|
||||||
}
|
}
|
||||||
|
|
||||||
void addListener(ptListener listenerChain, char name[], int age, int level) {
|
void addListener(ptListener listenerChain, int id, char name[], int age, int level) {
|
||||||
ptListener px = listenerChain;
|
ptListener px = listenerChain;
|
||||||
|
|
||||||
while (px -> next != NULL) {
|
while (px -> next != NULL) {
|
||||||
px = px -> next;
|
px = px -> next;
|
||||||
}
|
}
|
||||||
|
|
||||||
px -> id = findListenerId(listenerChain);
|
px -> id = id;
|
||||||
strcpy(px -> name, name);
|
strcpy(px -> name, name);
|
||||||
px -> age = age;
|
px -> age = age;
|
||||||
px -> level = level;
|
px -> level = level;
|
||||||
// ajouter la liste de conférences
|
px -> confs = (ptConfList) malloc(sizeof(tConfList));
|
||||||
px -> next = (ptListener) malloc(sizeof(tListener));
|
px -> next = (ptListener) malloc(sizeof(tListener));
|
||||||
px -> next -> next = NULL;
|
px -> next -> next = NULL;
|
||||||
px -> next -> prev = px;
|
px -> next -> prev = px;
|
||||||
|
|
6
conf.h
6
conf.h
|
@ -39,9 +39,11 @@ typedef tListener* ptListener;
|
||||||
typedef tConfList* ptConfList;
|
typedef tConfList* ptConfList;
|
||||||
typedef tListenerList* ptListenerList;
|
typedef tListenerList* ptListenerList;
|
||||||
|
|
||||||
|
int findConfId(ptConf confChain);
|
||||||
ptConf newConfChain();
|
ptConf newConfChain();
|
||||||
void addConf(ptConf confChainStart, char title[], char speaker[], int day, int month, int year);
|
void addConf(ptConf confChain, int id, char title[], char speaker[], int day, int month, int year);
|
||||||
|
int findListenerId(ptListener listenerChain);
|
||||||
ptListener newListenerChain();
|
ptListener newListenerChain();
|
||||||
void addListener(ptListener listenerChain, char name[], int age, int level);
|
void addListener(ptListener listenerChain, int id, char name[], int age, int level);
|
||||||
|
|
||||||
#endif // CONF_H
|
#endif // CONF_H
|
||||||
|
|
21
data/confs
21
data/confs
|
@ -2,18 +2,9 @@
|
||||||
2,coucou mes copains,Jean-Pierre,25,12,2023
|
2,coucou mes copains,Jean-Pierre,25,12,2023
|
||||||
3,coucou mes copains,Jean-Pierre,25,12,2023
|
3,coucou mes copains,Jean-Pierre,25,12,2023
|
||||||
4,coucou mes copains,Jean-Pierre,25,12,2023
|
4,coucou mes copains,Jean-Pierre,25,12,2023
|
||||||
5,test,tesst,21,120,2023
|
5,la,belle,6422476,762406370,6422132
|
||||||
6,test,tesst,21,120,2023
|
6,la,belle,6422476,-26872523,6422132
|
||||||
7,test,tesst,21,120,2023
|
7,e,e,22,7,2004
|
||||||
8,test,tesst,21,120,2023
|
8,Test,de,6422476,-1123880272,6422132
|
||||||
9,test,tesst,21,120,2023
|
9,Test,a,6422476,-2011631347,6422132
|
||||||
10,test,tesst,21,120,2023
|
10,test,test,1,1,1
|
||||||
11,test,tesst,21,120,2023
|
|
||||||
12,test,tesst,21,120,2023
|
|
||||||
13,test,tesst,21,120,2023
|
|
||||||
14,test,tesst,21,120,2023
|
|
||||||
15,test,tesst,21,120,2023
|
|
||||||
16,test,tesst,21,120,2023
|
|
||||||
17,test,tesst,21,120,2023
|
|
||||||
18,test,tesst,21,120,2023
|
|
||||||
19,test,tesst,21,120,2023
|
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
1,Roger,19,4
|
|
||||||
2,Roger,19,4
|
|
||||||
3,Roger,19,4
|
|
|
@ -25,7 +25,7 @@ void readConfs(ptConf confChain) {
|
||||||
token = strtok(NULL, ",");
|
token = strtok(NULL, ",");
|
||||||
}
|
}
|
||||||
|
|
||||||
addConf(confChain, tokens[1], tokens[2], atoi(tokens[3]), atoi(tokens[4]), atoi(tokens[5]));
|
addConf(confChain, atoi(tokens[0]), tokens[1], tokens[2], atoi(tokens[3]), atoi(tokens[4]), atoi(tokens[5]));
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
|
|
||||||
void readConfs();
|
void readConfs(ptConf confChain);
|
||||||
void saveConf(ptConf confChain);
|
void saveConf(ptConf confChain);
|
||||||
void saveListeners(ptListener listenerChain);
|
void saveListeners(ptListener listenerChain);
|
||||||
|
|
||||||
|
|
18
main.c
18
main.c
|
@ -10,19 +10,17 @@ int main()
|
||||||
ptListener listenerChain = newListenerChain();
|
ptListener listenerChain = newListenerChain();
|
||||||
|
|
||||||
readConfs(confChain);
|
readConfs(confChain);
|
||||||
|
|
||||||
addConf(confChain, "test", "tesst", 21, 120, 2023);
|
|
||||||
addConf(confChain, "test", "tesst", 21, 120, 2023);
|
|
||||||
addConf(confChain, "test", "tesst", 21, 120, 2023);
|
|
||||||
|
|
||||||
addListener(listenerChain, "Roger", 19, 4);
|
|
||||||
addListener(listenerChain, "Roger", 19, 4);
|
|
||||||
addListener(listenerChain, "Roger", 19, 4);
|
|
||||||
|
|
||||||
menu(confChain, listenerChain);
|
menu(confChain, listenerChain);
|
||||||
|
|
||||||
saveConf(confChain);
|
saveConf(confChain);
|
||||||
saveListeners(listenerChain);
|
saveListeners(listenerChain);
|
||||||
|
|
||||||
|
/*addConf(confChain, "test", "tesst", 21, 120, 2023);
|
||||||
|
addConf(confChain, "test", "tesst", 21, 120, 2023);
|
||||||
|
addConf(confChain, "test", "tesst", 21, 120, 2023);
|
||||||
|
|
||||||
|
addListener(listenerChain, "Roger", 19, 4);
|
||||||
|
addListener(listenerChain, "Roger", 19, 4);
|
||||||
|
addListener(listenerChain, "Roger", 19, 4);*/
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
BIN
main.exe
BIN
main.exe
Binary file not shown.
|
@ -98,7 +98,7 @@ void menuConf(ptConf confChain, ptListener listenerChain) {
|
||||||
ptConf px = confChain;
|
ptConf px = confChain;
|
||||||
|
|
||||||
while (px -> next != NULL) {
|
while (px -> next != NULL) {
|
||||||
printf("title : %s\nspeaker : %s\n", px -> title, px -> speaker);
|
printf("id : %d\ntitle : %s\nspeaker : %s\n", px -> id, px -> title, px -> speaker);
|
||||||
printf("%d/%d/%d\n\n",px -> day, px -> month, px -> year);
|
printf("%d/%d/%d\n\n",px -> day, px -> month, px -> year);
|
||||||
px = px -> next;
|
px = px -> next;
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,27 @@ void menuConf(ptConf confChain, ptListener listenerChain) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
|
{
|
||||||
|
int id, day, month, year;
|
||||||
|
char title[30];
|
||||||
|
char speaker[20];
|
||||||
|
|
||||||
|
id = findConfId(confChain);
|
||||||
|
printf("Titre de la conference : ");
|
||||||
|
scanf("%29s", &title);
|
||||||
|
printf("Nom du conferencier : ");
|
||||||
|
scanf("%19s", &speaker);
|
||||||
|
printf("Jour : ");
|
||||||
|
scanf("%d", &day);
|
||||||
|
printf("Mois : ");
|
||||||
|
scanf("%d", &month);
|
||||||
|
printf("Année : ");
|
||||||
|
scanf("%d", &year);
|
||||||
|
|
||||||
|
addConf(confChain, id, title, speaker, day, month, year);
|
||||||
|
menuConf(confChain, listenerChain);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
break;
|
break;
|
||||||
|
@ -146,7 +166,22 @@ void menuAbo(ptConf confChain, ptListener listenerChain) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
|
{
|
||||||
|
int id, age, level;
|
||||||
|
char name[20];
|
||||||
|
|
||||||
|
id = findListenerId(listenerChain);
|
||||||
|
printf("Nom : ");
|
||||||
|
scanf("%19s", &name);
|
||||||
|
printf("Age : ");
|
||||||
|
scanf("%d", &age);
|
||||||
|
printf("Niveau : ");
|
||||||
|
scanf("%d", &level);
|
||||||
|
|
||||||
|
addListener(listenerChain, id, name, age, level);
|
||||||
|
menuAbo(confChain, listenerChain);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
break;
|
break;
|
||||||
|
@ -163,10 +198,10 @@ void menuAbo(ptConf confChain, ptListener listenerChain) {
|
||||||
|
|
||||||
void menu(ptConf confChain, ptListener listenerChain)
|
void menu(ptConf confChain, ptListener listenerChain)
|
||||||
{
|
{
|
||||||
char *options[] = {"1/ Gestion des conferences", "2/ Gestion des abonnes", "3/ Participer a une conference", "4/ Voir la meilleure conference", "5/ Voir la participation a une conference", "6/ Quitter"};
|
char *options[] = {"1/ Gestion des conferences", "2/ Gestion des abonnes", "3/ Participer a une conference", "4/ Voir la meilleure conference", "5/ Voir la participation a une conference", "6/ Sauvegarder", "7/ Quitter"};
|
||||||
system("cls");
|
system("cls");
|
||||||
drawMenu(options, 6);
|
drawMenu(options, 7);
|
||||||
goToCoords(0, 14);
|
goToCoords(0, 15);
|
||||||
printf("Que voulez-vous faire ? : ");
|
printf("Que voulez-vous faire ? : ");
|
||||||
int choice;
|
int choice;
|
||||||
scanf("%d", &choice);
|
scanf("%d", &choice);
|
||||||
|
@ -191,6 +226,9 @@ void menu(ptConf confChain, ptListener listenerChain)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 6:
|
case 6:
|
||||||
|
saveConf(confChain);
|
||||||
|
saveListeners(listenerChain);
|
||||||
|
menu(confChain, listenerChain);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue