commit
This commit is contained in:
parent
bd738652a5
commit
031b51a916
10 changed files with 172 additions and 146 deletions
23
chaise.bat
23
chaise.bat
|
@ -1,23 +0,0 @@
|
||||||
@echo off
|
|
||||||
setlocal
|
|
||||||
|
|
||||||
:: Vérifier si Dev-Cpp est installé
|
|
||||||
reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Dev-Cpp" >nul 2>&1
|
|
||||||
if %errorlevel% equ 0 (
|
|
||||||
for /f "tokens=2*" %%a in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Dev-Cpp" /v Location ^| find "Location"') do (
|
|
||||||
set "mingwBin=%%b\MinGW64\bin"
|
|
||||||
)
|
|
||||||
|
|
||||||
:: Ajouter le chemin vers le bin de MinGW à la variable d'environnement PATH
|
|
||||||
echo %PATH% | find "%mingwBin%" >nul
|
|
||||||
if not errorlevel 1 (
|
|
||||||
echo Le chemin d'accès aux bin de MinGW est déjà présent dans la variable d'environnement PATH.
|
|
||||||
) else (
|
|
||||||
setx PATH "%PATH%;%mingwBin%" -m
|
|
||||||
echo Le chemin d'accès aux bin de MinGW a été ajouté à la variable d'environnement PATH.
|
|
||||||
)
|
|
||||||
) else (
|
|
||||||
echo Dev-Cpp n'est pas installé sur cet ordinateur.
|
|
||||||
)
|
|
||||||
|
|
||||||
endlocal
|
|
138
conf.c
138
conf.c
|
@ -21,7 +21,9 @@ int findConfId(ptConf confChain) {
|
||||||
ptConf newConfChain() {
|
ptConf newConfChain() {
|
||||||
ptConf confChain = (ptConf) malloc(sizeof(tConf));
|
ptConf confChain = (ptConf) malloc(sizeof(tConf));
|
||||||
|
|
||||||
confChain -> next = NULL;
|
confChain -> next = (ptConf) malloc(sizeof(tConf));
|
||||||
|
confChain -> next -> next = NULL;
|
||||||
|
confChain -> id = -1;
|
||||||
|
|
||||||
return confChain;
|
return confChain;
|
||||||
}
|
}
|
||||||
|
@ -40,7 +42,9 @@ void addConf(ptConf confChain, int id, char title[], char speaker[], int day, in
|
||||||
strcpy(px -> title, title);
|
strcpy(px -> title, title);
|
||||||
strcpy(px -> speaker, speaker);
|
strcpy(px -> speaker, speaker);
|
||||||
px -> listeners = (ptListenerList) malloc(sizeof(tListenerList));
|
px -> listeners = (ptListenerList) malloc(sizeof(tListenerList));
|
||||||
px -> listeners -> next = NULL;
|
px -> listeners -> next = (ptListenerList) malloc(sizeof(tListenerList));
|
||||||
|
px -> listeners -> listener = NULL;
|
||||||
|
px -> listeners -> next -> next = NULL;
|
||||||
px -> next = (ptConf) malloc(sizeof(tConf));
|
px -> next = (ptConf) malloc(sizeof(tConf));
|
||||||
px -> next -> next = NULL;
|
px -> next -> next = NULL;
|
||||||
}
|
}
|
||||||
|
@ -48,44 +52,21 @@ void addConf(ptConf confChain, int id, char title[], char speaker[], int day, in
|
||||||
void removeConf(ptConf confChain, int id) {
|
void removeConf(ptConf confChain, int id) {
|
||||||
ptConf px = confChain;
|
ptConf px = confChain;
|
||||||
|
|
||||||
if (px -> next -> next == NULL) {
|
while (px -> next != NULL && px -> next -> id != id) {
|
||||||
ptListenerList py = px -> listeners;
|
px = px -> next;
|
||||||
|
}
|
||||||
|
|
||||||
while (py -> next != NULL) {
|
if (px -> next != NULL && px -> next -> id == id) {
|
||||||
ptConfList pz = py -> listener -> confs;
|
ptListenerList py = px -> next -> listeners -> next;
|
||||||
|
|
||||||
while (pz -> next != NULL) {
|
while (py -> next != NULL) {
|
||||||
if (pz -> next -> next )
|
removeConfFromConfList(py -> listener -> confs, px -> next);
|
||||||
|
py = py -> next;
|
||||||
pz = pz -> next;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
py = py -> next;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
ptConf tmp = px -> next -> next;
|
||||||
free(px -> next);
|
free(px -> next);
|
||||||
px -> next = NULL;
|
px -> next = tmp;
|
||||||
} else if (px -> id == id) {
|
|
||||||
px -> id = px -> next -> id;
|
|
||||||
strcpy(px -> title, px -> next -> title);
|
|
||||||
strcpy(px -> speaker, px -> next -> speaker);
|
|
||||||
px -> day = px -> next -> day;
|
|
||||||
px -> month = px -> next -> month;
|
|
||||||
px -> year = px -> next -> year;
|
|
||||||
|
|
||||||
ptConf tmp = px -> next;
|
|
||||||
px -> next = px -> next -> next;
|
|
||||||
free(tmp);
|
|
||||||
} else {
|
|
||||||
while (px -> next != NULL && px -> next -> id != id) {
|
|
||||||
px = px -> next;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (px -> next -> id == id) {
|
|
||||||
ptConf tmp = px -> next;
|
|
||||||
px -> next = px -> next -> next;
|
|
||||||
free(tmp);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +89,9 @@ ptListener newListenerChain() {
|
||||||
ptListener listenerChain = (ptListener) malloc(sizeof(tListener));
|
ptListener listenerChain = (ptListener) malloc(sizeof(tListener));
|
||||||
|
|
||||||
listenerChain -> prev = NULL;
|
listenerChain -> prev = NULL;
|
||||||
listenerChain -> next = NULL;
|
listenerChain -> next = (ptListener) malloc(sizeof(tListener));
|
||||||
|
listenerChain -> next -> prev = listenerChain;
|
||||||
|
listenerChain -> id = -1;
|
||||||
|
|
||||||
return listenerChain;
|
return listenerChain;
|
||||||
}
|
}
|
||||||
|
@ -129,7 +112,9 @@ int addListener(ptListener listenerChain, int id, char name[], int age, int leve
|
||||||
px -> age = age;
|
px -> age = age;
|
||||||
px -> level = level;
|
px -> level = level;
|
||||||
px -> confs = (ptConfList) malloc(sizeof(tConfList));
|
px -> confs = (ptConfList) malloc(sizeof(tConfList));
|
||||||
px -> confs -> next = NULL;
|
px -> confs -> next = (ptConfList) malloc(sizeof(tConfList));
|
||||||
|
px -> confs -> conf = NULL;
|
||||||
|
px -> confs -> next -> next = NULL;
|
||||||
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;
|
||||||
|
@ -139,30 +124,22 @@ int addListener(ptListener listenerChain, int id, char name[], int age, int leve
|
||||||
void removeListener(ptListener listenerChain, int id) {
|
void removeListener(ptListener listenerChain, int id) {
|
||||||
ptListener px = listenerChain;
|
ptListener px = listenerChain;
|
||||||
|
|
||||||
if (px -> next -> next == NULL) {
|
while (px -> next != NULL && px -> next -> id != id) {
|
||||||
|
px = px -> next;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (px -> next != NULL && px -> next -> id == id) {
|
||||||
|
ptConfList py = px -> next -> confs -> next;
|
||||||
|
|
||||||
|
while (py -> next != NULL) {
|
||||||
|
removeListenerFromListenerList(py -> conf -> listeners, px -> next);
|
||||||
|
py = py -> next;
|
||||||
|
}
|
||||||
|
|
||||||
|
ptListener tmp = px -> next -> next;
|
||||||
free(px -> next);
|
free(px -> next);
|
||||||
px -> next = NULL;
|
px -> next = tmp;
|
||||||
} else if (px -> id == id) {
|
|
||||||
px -> id = px -> next -> id;
|
|
||||||
strcpy(px -> name, px -> next -> name);
|
|
||||||
px -> age = px -> next -> age;
|
|
||||||
px -> level = px -> next -> level;
|
|
||||||
|
|
||||||
ptListener tmp = px -> next;
|
|
||||||
px -> next = px -> next -> next;
|
|
||||||
px -> next -> prev = px;
|
px -> next -> prev = px;
|
||||||
free(tmp);
|
|
||||||
} else {
|
|
||||||
while (px -> next != NULL && px -> next -> id != id) {
|
|
||||||
px = px -> next;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (px -> next -> id == id) {
|
|
||||||
ptListener tmp = px -> next;
|
|
||||||
px -> next = px -> next -> next;
|
|
||||||
px -> next -> prev = px;
|
|
||||||
free(tmp);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,6 +156,25 @@ void addConfToConfList(ptConfList confList, ptConf conf, int grade) {
|
||||||
px -> next -> next = NULL;
|
px -> next -> next = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void removeConfFromConfList(ptConfList confList, ptConf conf) {
|
||||||
|
ptConfList px = confList;
|
||||||
|
|
||||||
|
while (px -> next != NULL && px -> conf != conf) {
|
||||||
|
px = px -> next;
|
||||||
|
}
|
||||||
|
|
||||||
|
printConfList(confList -> next);
|
||||||
|
printf("%d\n", px -> conf -> id);
|
||||||
|
|
||||||
|
if (px -> next != NULL && px -> next -> conf == conf) {
|
||||||
|
ptConfList tmp = px -> next -> next;
|
||||||
|
free(px -> next);
|
||||||
|
px -> next = tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
system("pause");
|
||||||
|
}
|
||||||
|
|
||||||
void printConfList(ptConfList confList) {
|
void printConfList(ptConfList confList) {
|
||||||
ptConfList px = confList;
|
ptConfList px = confList;
|
||||||
|
|
||||||
|
@ -203,10 +199,24 @@ void addListenerToListenerList(ptListenerList listenerList, ptListener listener,
|
||||||
px -> next -> next = NULL;
|
px -> next -> next = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void removeListenerFromListenerList(ptListenerList listenerList, ptListener listener) {
|
||||||
|
ptListenerList px = listenerList;
|
||||||
|
|
||||||
|
while (px -> next != NULL && px -> listener != listener) {
|
||||||
|
px = px -> next;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (px -> next != NULL && px -> next -> listener == listener) {
|
||||||
|
ptListenerList tmp = px -> next -> next;
|
||||||
|
free(px -> next);
|
||||||
|
px -> next = tmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void printListenerList(ptListenerList listenerList) {
|
void printListenerList(ptListenerList listenerList) {
|
||||||
ptListenerList px = listenerList;
|
ptListenerList px = listenerList;
|
||||||
|
|
||||||
printf(" Participants : ");
|
printf("Participants : ");
|
||||||
while (px -> next != NULL) {
|
while (px -> next != NULL) {
|
||||||
printf("%s(%d) ", px -> listener -> name, px -> grade);
|
printf("%s(%d) ", px -> listener -> name, px -> grade);
|
||||||
px = px -> next;
|
px = px -> next;
|
||||||
|
@ -227,7 +237,7 @@ int participateToConf(ptConf confChain, ptListener listenerChain, int confId, in
|
||||||
px = px -> next;
|
px = px -> next;
|
||||||
}
|
}
|
||||||
|
|
||||||
pz = px -> listeners;
|
pz = px -> listeners -> next;
|
||||||
while (pz -> next != NULL) {
|
while (pz -> next != NULL) {
|
||||||
if (pz -> listener -> id == listenerId) {
|
if (pz -> listener -> id == listenerId) {
|
||||||
return -2;
|
return -2;
|
||||||
|
@ -250,7 +260,7 @@ int participateToConf(ptConf confChain, ptListener listenerChain, int confId, in
|
||||||
}
|
}
|
||||||
|
|
||||||
int confGradeAvg(ptConf conf) {
|
int confGradeAvg(ptConf conf) {
|
||||||
ptListenerList px = conf -> listeners;
|
ptListenerList px = conf -> listeners -> next;
|
||||||
int total = 0, nb = 0;
|
int total = 0, nb = 0;
|
||||||
|
|
||||||
while (px -> next != NULL) {
|
while (px -> next != NULL) {
|
||||||
|
@ -268,7 +278,7 @@ int confGradeAvg(ptConf conf) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int confParticipations(ptConf conf) {
|
int confParticipations(ptConf conf) {
|
||||||
ptListenerList px = conf -> listeners;
|
ptListenerList px = conf -> listeners -> next;
|
||||||
int nb = 0;
|
int nb = 0;
|
||||||
|
|
||||||
while (px -> next != NULL) {
|
while (px -> next != NULL) {
|
||||||
|
|
2
conf.h
2
conf.h
|
@ -50,8 +50,10 @@ ptListener newListenerChain();
|
||||||
int addListener(ptListener listenerChain, int id, char name[], int age, int level);
|
int addListener(ptListener listenerChain, int id, char name[], int age, int level);
|
||||||
void removeListener(ptListener listenerChain, int id);
|
void removeListener(ptListener listenerChain, int id);
|
||||||
void addConfToConfList(ptConfList confList, ptConf conf, int grade);
|
void addConfToConfList(ptConfList confList, ptConf conf, int grade);
|
||||||
|
void removeConfFromConfList(ptConfList confList, ptConf conf);
|
||||||
void printConfList(ptConfList confList);
|
void printConfList(ptConfList confList);
|
||||||
void addListenerToListenerList(ptListenerList listenerList, ptListener listener, int grade);
|
void addListenerToListenerList(ptListenerList listenerList, ptListener listener, int grade);
|
||||||
|
void removeListenerFromListenerList(ptListenerList listenerList, ptListener listener);
|
||||||
void printListenerList(ptListenerList listenerList);
|
void printListenerList(ptListenerList listenerList);
|
||||||
int participateToConf(ptConf confChain, ptListener listenerChain, int confId, int listenerId, int grade);
|
int participateToConf(ptConf confChain, ptListener listenerChain, int confId, int listenerId, int grade);
|
||||||
int confGradeAvg(ptConf conf);
|
int confGradeAvg(ptConf conf);
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
1,Rapport_du_GIEC,Jean_Jouzzel,15,11,2022
|
|
||||||
2,L_esprit_critique,Thomas_Durand,6,2,2023
|
2,L_esprit_critique,Thomas_Durand,6,2,2023
|
||||||
3,La_resilience,Arthur_Keller,20,10,2022
|
3,La_resilience,Arthur_Keller,20,10,2022
|
||||||
4,American_lobbying,Salah_Oueslati,30,11,2023
|
4,American_lobbying,Salah_Oueslati,30,11,2023
|
||||||
|
@ -9,3 +8,4 @@
|
||||||
9,Le_lacet_irlandais,Mick_Oconnell,31,3,2022
|
9,Le_lacet_irlandais,Mick_Oconnell,31,3,2022
|
||||||
10,Litterature_et_SF,Terry_Pratchett,15,5,2021
|
10,Litterature_et_SF,Terry_Pratchett,15,5,2021
|
||||||
11,Les_chaises_en_bois,David,24,12,2023
|
11,Les_chaises_en_bois,David,24,12,2023
|
||||||
|
12,cybersecurite_des_coquillages,Bob,6,2,2024
|
||||||
|
|
|
@ -1,2 +1,5 @@
|
||||||
1:12;0,1;4
|
1:12;0,1;4
|
||||||
|
2:12;0,1;4
|
||||||
|
3:12;0,1;4
|
||||||
|
4:12;0,1;4
|
||||||
9:20;5
|
9:20;5
|
||||||
|
|
|
@ -9,3 +9,4 @@
|
||||||
9,Le_lacet_irlandais,Mick_Oconnell,31,3,2022
|
9,Le_lacet_irlandais,Mick_Oconnell,31,3,2022
|
||||||
10,Litterature_et_SF,Terry_Pratchett,15,5,2021
|
10,Litterature_et_SF,Terry_Pratchett,15,5,2021
|
||||||
11,Les_chaises_en_bois,David,24,12,2023
|
11,Les_chaises_en_bois,David,24,12,2023
|
||||||
|
12,cybersecurite_des_coquillages,Bob,6,2,2024
|
||||||
|
|
BIN
main.exe
BIN
main.exe
Binary file not shown.
|
@ -113,18 +113,18 @@ void menuConf(ptConf confChain, ptListener listenerChain) {
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
ptConf px = confChain;
|
ptConf px = confChain -> next;
|
||||||
|
|
||||||
while (px -> next != NULL) {
|
while (px -> next != NULL) {
|
||||||
printf(" Id : %d\n Titre : %s\n Conferencier : %s\n", px -> id, px -> title, px -> speaker);
|
printf("Id : %d\nTitre : %s\nConferencier : %s\n", px -> id, px -> title, px -> speaker);
|
||||||
printf(" Date : %d/%d/%d\n",px -> day, px -> month, px -> year);
|
printf("Date : %d/%d/%d\n",px -> day, px -> month, px -> year);
|
||||||
printf(" Nombre de participants : %d\n", confParticipations(px));
|
printf("Nombre de participants : %d\n", confParticipations(px));
|
||||||
if (px -> listeners -> next != NULL ) {
|
if (px -> listeners -> next != NULL ) {
|
||||||
printListenerList(px -> listeners);
|
printListenerList(px -> listeners -> next);
|
||||||
}
|
}
|
||||||
int avg;
|
int avg;
|
||||||
if ((avg = confGradeAvg(px) != -1)) {
|
if ((avg = confGradeAvg(px) != -1)) {
|
||||||
printf(" Moyenne des notes : %d\n", confGradeAvg(px));
|
printf("Moyenne des notes : %d\n", confGradeAvg(px));
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
px = px -> next;
|
px = px -> next;
|
||||||
|
@ -141,19 +141,19 @@ void menuConf(ptConf confChain, ptListener listenerChain) {
|
||||||
char speaker[20];
|
char speaker[20];
|
||||||
|
|
||||||
id = findConfId(confChain);
|
id = findConfId(confChain);
|
||||||
printf(" Titre de la conference : ");
|
printf("Titre de la conference : ");
|
||||||
scanf("%29s", &title);
|
scanf("%29s", &title);
|
||||||
printf(" Nom du conferencier : ");
|
printf("Nom du conferencier : ");
|
||||||
scanf("%19s", &speaker);
|
scanf("%19s", &speaker);
|
||||||
printf(" Jour : ");
|
printf("Jour : ");
|
||||||
scanf("%d", &day);
|
scanf("%d", &day);
|
||||||
printf(" Mois : ");
|
printf("Mois : ");
|
||||||
scanf("%d", &month);
|
scanf("%d", &month);
|
||||||
printf(" Annee : ");
|
printf("Annee : ");
|
||||||
scanf("%d", &year);
|
scanf("%d", &year);
|
||||||
|
|
||||||
addConf(confChain, id, title, speaker, day, month, year);
|
addConf(confChain, id, title, speaker, day, month, year);
|
||||||
saveConf(confChain);
|
saveConf(confChain -> next);
|
||||||
menuConf(confChain, listenerChain);
|
menuConf(confChain, listenerChain);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -162,11 +162,11 @@ void menuConf(ptConf confChain, ptListener listenerChain) {
|
||||||
{
|
{
|
||||||
int id;
|
int id;
|
||||||
|
|
||||||
printf(" Id de la conference a supprimer : ");
|
printf("Id de la conference a supprimer : ");
|
||||||
scanf("%d", &id);
|
scanf("%d", &id);
|
||||||
|
|
||||||
removeConf(confChain, id);
|
removeConf(confChain, id);
|
||||||
saveConf(confChain);
|
saveConf(confChain -> next);
|
||||||
menuConf(confChain, listenerChain);
|
menuConf(confChain, listenerChain);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -174,11 +174,11 @@ void menuConf(ptConf confChain, ptListener listenerChain) {
|
||||||
case 4:
|
case 4:
|
||||||
{
|
{
|
||||||
int day, month, year, time;
|
int day, month, year, time;
|
||||||
printf(" Jour : ");
|
printf("Jour : ");
|
||||||
scanf("%d", &day);
|
scanf("%d", &day);
|
||||||
printf(" Mois : ");
|
printf("Mois : ");
|
||||||
scanf("%d", &month);
|
scanf("%d", &month);
|
||||||
printf(" Annee : ");
|
printf("Annee : ");
|
||||||
scanf("%d", &year);
|
scanf("%d", &year);
|
||||||
|
|
||||||
time = day + 31 * month + 365 * year;
|
time = day + 31 * month + 365 * year;
|
||||||
|
@ -197,7 +197,7 @@ void menuConf(ptConf confChain, ptListener listenerChain) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
saveConf(confChain);
|
saveConf(confChain -> next);
|
||||||
|
|
||||||
menuConf(confChain, listenerChain);
|
menuConf(confChain, listenerChain);
|
||||||
}
|
}
|
||||||
|
@ -216,7 +216,7 @@ void menuAbo(ptConf confChain, ptListener listenerChain) {
|
||||||
system("cls");
|
system("cls");
|
||||||
drawMenu(options, 4);
|
drawMenu(options, 4);
|
||||||
goToCoords(0, 12);
|
goToCoords(0, 12);
|
||||||
printf(" Que voulez-vous faire ? : ");
|
printf("Que voulez-vous faire ? : ");
|
||||||
int choice;
|
int choice;
|
||||||
scanf("%d", &choice);
|
scanf("%d", &choice);
|
||||||
|
|
||||||
|
@ -224,12 +224,12 @@ void menuAbo(ptConf confChain, ptListener listenerChain) {
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
ptListener py = listenerChain;
|
ptListener py = listenerChain -> next;
|
||||||
|
|
||||||
while (py -> next != NULL) {
|
while (py -> next != NULL) {
|
||||||
printf(" Id : %d\n Nom: %s\n Age: %d\n Niveau: %d\n", py -> id, py -> name, py -> age, py -> level);
|
printf("Id : %d\nNom: %s\nAge: %d\nNiveau: %d\n", py -> id, py -> name, py -> age, py -> level);
|
||||||
if (py -> confs -> next != NULL) {
|
if (py -> confs -> next != NULL) {
|
||||||
printConfList(py -> confs);
|
printConfList(py -> confs -> next);
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
py = py -> next;
|
py = py -> next;
|
||||||
|
@ -245,17 +245,17 @@ void menuAbo(ptConf confChain, ptListener listenerChain) {
|
||||||
char name[20];
|
char name[20];
|
||||||
|
|
||||||
id = findListenerId(listenerChain);
|
id = findListenerId(listenerChain);
|
||||||
printf(" Nom : ");
|
printf("Nom : ");
|
||||||
scanf("%19s", &name);
|
scanf("%19s", &name);
|
||||||
printf(" Age : ");
|
printf("Age : ");
|
||||||
scanf("%d", &age);
|
scanf("%d", &age);
|
||||||
printf(" Niveau : ");
|
printf("Niveau : ");
|
||||||
scanf("%d", &level);
|
scanf("%d", &level);
|
||||||
|
|
||||||
if (addListener(listenerChain, id, name, age, level) != -1) {
|
if (addListener(listenerChain, id, name, age, level) != -1) {
|
||||||
saveListeners(listenerChain);
|
saveListeners(listenerChain -> next);
|
||||||
} else {
|
} else {
|
||||||
printf(" Le niveau de l'abonne doit etre compris entre 0 et 5.\n\n");
|
printf("Le niveau de l'abonne doit etre compris entre 0 et 5.\n\n");
|
||||||
system("pause");
|
system("pause");
|
||||||
}
|
}
|
||||||
menuAbo(confChain, listenerChain);
|
menuAbo(confChain, listenerChain);
|
||||||
|
@ -266,11 +266,11 @@ void menuAbo(ptConf confChain, ptListener listenerChain) {
|
||||||
{
|
{
|
||||||
int id;
|
int id;
|
||||||
|
|
||||||
printf(" Id de l'abonne a supprimer : ");
|
printf("Id de l'abonne a supprimer : ");
|
||||||
scanf("%d", &id);
|
scanf("%d", &id);
|
||||||
|
|
||||||
removeListener(listenerChain, id);
|
removeListener(listenerChain, id);
|
||||||
saveListeners(listenerChain);
|
saveListeners(listenerChain -> next);
|
||||||
menuAbo(confChain, listenerChain);
|
menuAbo(confChain, listenerChain);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -292,7 +292,7 @@ void menu(ptConf confChain, ptListener listenerChain)
|
||||||
goToCoords(0, 13);
|
goToCoords(0, 13);
|
||||||
tasse();
|
tasse();
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf(" Que voulez-vous faire ? : ");
|
printf("Que voulez-vous faire ? : ");
|
||||||
int choice;
|
int choice;
|
||||||
scanf("%d", &choice);
|
scanf("%d", &choice);
|
||||||
|
|
||||||
|
@ -309,17 +309,17 @@ void menu(ptConf confChain, ptListener listenerChain)
|
||||||
case 3:
|
case 3:
|
||||||
{
|
{
|
||||||
int confId, listenerId, grade;
|
int confId, listenerId, grade;
|
||||||
printf(" Entrez l'ID de la conference : ");
|
printf("Entrez l'ID de la conference : ");
|
||||||
scanf("%d", &confId);
|
scanf("%d", &confId);
|
||||||
printf(" Entrez l'ID du participant : ");
|
printf("Entrez l'ID du participant : ");
|
||||||
scanf("%d", &listenerId);
|
scanf("%d", &listenerId);
|
||||||
printf(" Entrez la note attribuee par le participant : ");
|
printf("Entrez la note attribuee par le participant : ");
|
||||||
scanf("%d", &grade);
|
scanf("%d", &grade);
|
||||||
|
|
||||||
if (participateToConf(confChain, listenerChain, confId, listenerId, grade) != -1) {
|
if (participateToConf(confChain, listenerChain, confId, listenerId, grade) != -1) {
|
||||||
saveRelations(confChain);
|
saveRelations(confChain);
|
||||||
} else {
|
} else {
|
||||||
printf(" La note doit etre comprise entre 0 et 5 et l'abonne ne doit pas avoir deja participe a la conference\n\n");
|
printf("La note doit etre comprise entre 0 et 5 et l'abonne ne doit pas avoir deja participe a la conference\n\n");
|
||||||
system("pause");
|
system("pause");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -343,7 +343,7 @@ void menu(ptConf confChain, ptListener listenerChain)
|
||||||
px = px -> next;
|
px = px -> next;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf(" La conférence la mieux notee est : %s\n\n", confMax -> title);
|
printf("La conférence la mieux notee est : %s\n\n", confMax -> title);
|
||||||
|
|
||||||
system("pause");
|
system("pause");
|
||||||
menu(confChain, listenerChain);
|
menu(confChain, listenerChain);
|
||||||
|
|
73
singleFile.c
73
singleFile.c
|
@ -119,28 +119,17 @@ void removeConf(ptConf confChain, int id)
|
||||||
{
|
{
|
||||||
ptConf px = confChain;
|
ptConf px = confChain;
|
||||||
|
|
||||||
if (px->next->next == NULL)
|
if (px->next == NULL)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (px->next->next == NULL)
|
||||||
{
|
{
|
||||||
ptListenerList py = px->listeners;
|
|
||||||
|
|
||||||
while (py->next != NULL)
|
|
||||||
{
|
|
||||||
ptConfList pz = py->listener->confs;
|
|
||||||
|
|
||||||
while (pz->next != NULL)
|
|
||||||
{
|
|
||||||
if (pz->next->next)
|
|
||||||
|
|
||||||
pz = pz->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
py = py->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
free(px->next);
|
free(px->next);
|
||||||
px->next = NULL;
|
px->next = NULL;
|
||||||
}
|
}
|
||||||
else if (px->id == id)
|
else if (px->id == id && px->next->next != NULL)
|
||||||
{
|
{
|
||||||
px->id = px->next->id;
|
px->id = px->next->id;
|
||||||
strcpy(px->title, px->next->title);
|
strcpy(px->title, px->next->title);
|
||||||
|
@ -226,8 +215,11 @@ int addListener(ptListener listenerChain, int id, char name[], int age, int leve
|
||||||
void removeListener(ptListener listenerChain, int id)
|
void removeListener(ptListener listenerChain, int id)
|
||||||
{
|
{
|
||||||
ptListener px = listenerChain;
|
ptListener px = listenerChain;
|
||||||
|
if (px->next == NULL)
|
||||||
if (px->next->next == NULL)
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (px->id == id && px->next->next == NULL)
|
||||||
{
|
{
|
||||||
free(px->next);
|
free(px->next);
|
||||||
px->next = NULL;
|
px->next = NULL;
|
||||||
|
@ -276,11 +268,52 @@ void addConfToConfList(ptConfList confList, ptConf conf, int grade)
|
||||||
px->next->next = NULL;
|
px->next->next = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void removeConfFromConfList(ptConf confChain, ptConfList confList, ptConf conf)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (confList->next == NULL)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (confList->next->next == NULL && confList->conf == conf)
|
||||||
|
{
|
||||||
|
free(confList->next);
|
||||||
|
confList->next = NULL;
|
||||||
|
}
|
||||||
|
else if (confList->conf == conf && confList->next->next != NULL)
|
||||||
|
{
|
||||||
|
confList->conf = confList->next->conf;
|
||||||
|
confList->grade = confList->next->grade;
|
||||||
|
ptConfList tmp = confList->next->next;
|
||||||
|
free(confList->next);
|
||||||
|
confList->next = tmp;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ptConfList px = confList;
|
||||||
|
|
||||||
|
while (px->next != NULL && px->next->conf != conf)
|
||||||
|
{
|
||||||
|
if (confChain == conf && px->conf == conf->next) {
|
||||||
|
px->conf
|
||||||
|
}
|
||||||
|
|
||||||
|
px = px->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (px->next->conf == conf) {
|
||||||
|
ptConfList tmp = px->next->next;
|
||||||
|
free(px->next);
|
||||||
|
px->next = tmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void printConfList(ptConfList confList)
|
void printConfList(ptConfList confList)
|
||||||
{
|
{
|
||||||
ptConfList px = confList;
|
ptConfList px = confList;
|
||||||
|
|
||||||
printf("Participation aux conferences : ");
|
printf(" Participation aux conferences : ");
|
||||||
while (px->next != NULL)
|
while (px->next != NULL)
|
||||||
{
|
{
|
||||||
printf("%s(%d) ", px->conf->title, px->grade);
|
printf("%s(%d) ", px->conf->title, px->grade);
|
||||||
|
|
BIN
singleFile.exe
Normal file
BIN
singleFile.exe
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue