commit
This commit is contained in:
parent
63e83a9601
commit
bd738652a5
13 changed files with 1115 additions and 39 deletions
|
@ -82,8 +82,26 @@ void drawMenu(char *options[], int lenght) {
|
|||
|
||||
}
|
||||
|
||||
/*
|
||||
( ) ( ) )
|
||||
) ( ) ( (
|
||||
( ) ( ) )
|
||||
_____________
|
||||
<_____________> ___
|
||||
| |/ _ \
|
||||
| | | |
|
||||
| |_| |
|
||||
___| |\___/
|
||||
/ \___________/ \
|
||||
\_____________________/
|
||||
*/
|
||||
|
||||
void tasse() {
|
||||
printf(" ( ) ( ) )\n ) ( ) ( (\n ( ) ( ) )\n _____________\n <_____________> ___\n | |/ _ \\\n | | | |\n | |_| |\n ___| |\\___/\n/ \\___________/ \\\n\\_____________________/\n");
|
||||
}
|
||||
|
||||
void menuConf(ptConf confChain, ptListener listenerChain) {
|
||||
char *options[] = {"1/ Voir la liste des conferences", "2/ Ajouter une conference", "3/ Suprimer une conference", "4/ Supprimer les conferences inferieures a une date", "5/ Retour"};
|
||||
char *options[] = {"1/ Voir la liste des conferences", "2/ Ajouter une conference", "3/ Supprimer une conference", "4/ Supprimer les conferences inferieures a une date", "5/ Retour"};
|
||||
system("cls");
|
||||
drawMenu(options, 5);
|
||||
goToCoords(0, 13);
|
||||
|
@ -98,15 +116,15 @@ void menuConf(ptConf confChain, ptListener listenerChain) {
|
|||
ptConf px = confChain;
|
||||
|
||||
while (px -> next != NULL) {
|
||||
printf("Id : %d\nTitre : %s\nConférencier : %s\n", px -> id, px -> title, px -> speaker);
|
||||
printf("Date : %d/%d/%d\n",px -> day, px -> month, px -> year);
|
||||
printf("Nombre de participants : %d\n", confParticipations(px));
|
||||
printf(" Id : %d\n Titre : %s\n Conferencier : %s\n", px -> id, px -> title, px -> speaker);
|
||||
printf(" Date : %d/%d/%d\n",px -> day, px -> month, px -> year);
|
||||
printf(" Nombre de participants : %d\n", confParticipations(px));
|
||||
if (px -> listeners -> next != NULL ) {
|
||||
printListenerList(px -> listeners);
|
||||
}
|
||||
int avg;
|
||||
if ((avg = confGradeAvg(px) != -1)) {
|
||||
printf("Moyenne des notes : %d\n", confGradeAvg(px));
|
||||
printf(" Moyenne des notes : %d\n", confGradeAvg(px));
|
||||
}
|
||||
printf("\n");
|
||||
px = px -> next;
|
||||
|
@ -123,15 +141,15 @@ void menuConf(ptConf confChain, ptListener listenerChain) {
|
|||
char speaker[20];
|
||||
|
||||
id = findConfId(confChain);
|
||||
printf("Titre de la conference : ");
|
||||
printf(" Titre de la conference : ");
|
||||
scanf("%29s", &title);
|
||||
printf("Nom du conferencier : ");
|
||||
printf(" Nom du conferencier : ");
|
||||
scanf("%19s", &speaker);
|
||||
printf("Jour : ");
|
||||
printf(" Jour : ");
|
||||
scanf("%d", &day);
|
||||
printf("Mois : ");
|
||||
printf(" Mois : ");
|
||||
scanf("%d", &month);
|
||||
printf("Année : ");
|
||||
printf(" Annee : ");
|
||||
scanf("%d", &year);
|
||||
|
||||
addConf(confChain, id, title, speaker, day, month, year);
|
||||
|
@ -144,7 +162,7 @@ void menuConf(ptConf confChain, ptListener listenerChain) {
|
|||
{
|
||||
int id;
|
||||
|
||||
printf("Id de la conference à supprimer : ");
|
||||
printf(" Id de la conference a supprimer : ");
|
||||
scanf("%d", &id);
|
||||
|
||||
removeConf(confChain, id);
|
||||
|
@ -156,27 +174,31 @@ void menuConf(ptConf confChain, ptListener listenerChain) {
|
|||
case 4:
|
||||
{
|
||||
int day, month, year, time;
|
||||
printf("Jour : ");
|
||||
printf(" Jour : ");
|
||||
scanf("%d", &day);
|
||||
printf("Mois : ");
|
||||
printf(" Mois : ");
|
||||
scanf("%d", &month);
|
||||
printf("Annee : ");
|
||||
printf(" Annee : ");
|
||||
scanf("%d", &year);
|
||||
|
||||
time = day + 31 * month * 365 * year;
|
||||
time = day + 31 * month + 365 * year;
|
||||
|
||||
ptConf px = confChain;
|
||||
|
||||
while(px -> next != NULL) {
|
||||
if ((px -> day + px -> month * 31 + px -> year * 365) < time) {
|
||||
if ((px -> day + px -> month * 31 + px -> year * 365) < time && px != confChain) {
|
||||
ptConf py = px -> next;
|
||||
removeConf(confChain, px -> id);
|
||||
px = py;
|
||||
} else if ((px -> day + px -> month * 31 + px -> year * 365) < time && px == confChain) {
|
||||
removeConf(confChain, px -> id);
|
||||
} else {
|
||||
px = px -> next;
|
||||
}
|
||||
}
|
||||
|
||||
saveConf(confChain);
|
||||
|
||||
menuConf(confChain, listenerChain);
|
||||
}
|
||||
|
||||
|
@ -194,7 +216,7 @@ void menuAbo(ptConf confChain, ptListener listenerChain) {
|
|||
system("cls");
|
||||
drawMenu(options, 4);
|
||||
goToCoords(0, 12);
|
||||
printf("Que voulez-vous faire ? : ");
|
||||
printf(" Que voulez-vous faire ? : ");
|
||||
int choice;
|
||||
scanf("%d", &choice);
|
||||
|
||||
|
@ -205,7 +227,7 @@ void menuAbo(ptConf confChain, ptListener listenerChain) {
|
|||
ptListener py = listenerChain;
|
||||
|
||||
while (py -> next != NULL) {
|
||||
printf("id : %d\nname: %s\nage: %d\nlevel: %d\n", py -> id, py -> name, py -> age, py -> level);
|
||||
printf(" Id : %d\n Nom: %s\n Age: %d\n Niveau: %d\n", py -> id, py -> name, py -> age, py -> level);
|
||||
if (py -> confs -> next != NULL) {
|
||||
printConfList(py -> confs);
|
||||
}
|
||||
|
@ -223,15 +245,19 @@ void menuAbo(ptConf confChain, ptListener listenerChain) {
|
|||
char name[20];
|
||||
|
||||
id = findListenerId(listenerChain);
|
||||
printf("Nom : ");
|
||||
printf(" Nom : ");
|
||||
scanf("%19s", &name);
|
||||
printf("Age : ");
|
||||
printf(" Age : ");
|
||||
scanf("%d", &age);
|
||||
printf("Niveau : ");
|
||||
printf(" Niveau : ");
|
||||
scanf("%d", &level);
|
||||
|
||||
addListener(listenerChain, id, name, age, level);
|
||||
saveListeners(listenerChain);
|
||||
if (addListener(listenerChain, id, name, age, level) != -1) {
|
||||
saveListeners(listenerChain);
|
||||
} else {
|
||||
printf(" Le niveau de l'abonne doit etre compris entre 0 et 5.\n\n");
|
||||
system("pause");
|
||||
}
|
||||
menuAbo(confChain, listenerChain);
|
||||
break;
|
||||
}
|
||||
|
@ -240,7 +266,7 @@ void menuAbo(ptConf confChain, ptListener listenerChain) {
|
|||
{
|
||||
int id;
|
||||
|
||||
printf("Id de l'abonne à supprimer : ");
|
||||
printf(" Id de l'abonne a supprimer : ");
|
||||
scanf("%d", &id);
|
||||
|
||||
removeListener(listenerChain, id);
|
||||
|
@ -264,7 +290,9 @@ void menu(ptConf confChain, ptListener listenerChain)
|
|||
system("cls");
|
||||
drawMenu(options, 5);
|
||||
goToCoords(0, 13);
|
||||
printf("Que voulez-vous faire ? : ");
|
||||
tasse();
|
||||
printf("\n");
|
||||
printf(" Que voulez-vous faire ? : ");
|
||||
int choice;
|
||||
scanf("%d", &choice);
|
||||
|
||||
|
@ -281,15 +309,20 @@ void menu(ptConf confChain, ptListener listenerChain)
|
|||
case 3:
|
||||
{
|
||||
int confId, listenerId, grade;
|
||||
printf("Entrez l'ID de la conference : ");
|
||||
printf(" Entrez l'ID de la conference : ");
|
||||
scanf("%d", &confId);
|
||||
printf("Entrez l'ID du participant : ");
|
||||
printf(" Entrez l'ID du participant : ");
|
||||
scanf("%d", &listenerId);
|
||||
printf("Entrez la note attribuée par le participant : ");
|
||||
printf(" Entrez la note attribuee par le participant : ");
|
||||
scanf("%d", &grade);
|
||||
|
||||
participateToConf(confChain, listenerChain, confId, listenerId, grade);
|
||||
saveRelations(confChain);
|
||||
if (participateToConf(confChain, listenerChain, confId, listenerId, grade) != -1) {
|
||||
saveRelations(confChain);
|
||||
} 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");
|
||||
system("pause");
|
||||
}
|
||||
|
||||
menu(confChain, listenerChain);
|
||||
break;
|
||||
}
|
||||
|
@ -310,7 +343,7 @@ void menu(ptConf confChain, ptListener listenerChain)
|
|||
px = px -> next;
|
||||
}
|
||||
|
||||
printf("La conférence la mieux notée est : %s\n\n", confMax -> title);
|
||||
printf(" La conférence la mieux notee est : %s\n\n", confMax -> title);
|
||||
|
||||
system("pause");
|
||||
menu(confChain, listenerChain);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue