commit
This commit is contained in:
parent
c755619819
commit
63e83a9601
6 changed files with 153 additions and 85 deletions
|
@ -83,10 +83,10 @@ void drawMenu(char *options[], int lenght) {
|
|||
}
|
||||
|
||||
void menuConf(ptConf confChain, ptListener listenerChain) {
|
||||
char *options[] = {"1/ Voir la liste des conferences", "2/ Ajouter une conference", "3/ Suprimer une conference", "4/ Retour"};
|
||||
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"};
|
||||
system("cls");
|
||||
drawMenu(options, 4);
|
||||
goToCoords(0, 12);
|
||||
drawMenu(options, 5);
|
||||
goToCoords(0, 13);
|
||||
printf("Que voulez-vous faire ? : ");
|
||||
int choice;
|
||||
scanf("%d", &choice);
|
||||
|
@ -94,21 +94,27 @@ void menuConf(ptConf confChain, ptListener listenerChain) {
|
|||
switch (choice)
|
||||
{
|
||||
case 1:
|
||||
system ("cls");
|
||||
{
|
||||
ptConf px = confChain;
|
||||
|
||||
while (px -> next != NULL) {
|
||||
printf("id : %d\ntitle : %s\nspeaker : %s\n", px -> id, px -> title, px -> speaker);
|
||||
printf("%d/%d/%d\n",px -> day, px -> month, px -> year);
|
||||
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));
|
||||
if (px -> listeners -> next != NULL ) {
|
||||
printListenerList(px -> listeners);
|
||||
}
|
||||
int avg;
|
||||
if ((avg = confGradeAvg(px) != -1)) {
|
||||
printf("Moyenne des notes : %d\n", confGradeAvg(px));
|
||||
}
|
||||
printf("\n");
|
||||
px = px -> next;
|
||||
}
|
||||
system("pause");
|
||||
menuConf(confChain, listenerChain);
|
||||
break;
|
||||
}
|
||||
|
||||
case 2:
|
||||
{
|
||||
|
@ -148,6 +154,33 @@ void menuConf(ptConf confChain, ptListener listenerChain) {
|
|||
}
|
||||
|
||||
case 4:
|
||||
{
|
||||
int day, month, year, time;
|
||||
printf("Jour : ");
|
||||
scanf("%d", &day);
|
||||
printf("Mois : ");
|
||||
scanf("%d", &month);
|
||||
printf("Annee : ");
|
||||
scanf("%d", &year);
|
||||
|
||||
time = day + 31 * month * 365 * year;
|
||||
|
||||
ptConf px = confChain;
|
||||
|
||||
while(px -> next != NULL) {
|
||||
if ((px -> day + px -> month * 31 + px -> year * 365) < time) {
|
||||
ptConf py = px -> next;
|
||||
removeConf(confChain, px -> id);
|
||||
px = py;
|
||||
} else {
|
||||
px = px -> next;
|
||||
}
|
||||
}
|
||||
|
||||
menuConf(confChain, listenerChain);
|
||||
}
|
||||
|
||||
case 5:
|
||||
menu(confChain, listenerChain);
|
||||
break;
|
||||
|
||||
|
@ -168,7 +201,7 @@ void menuAbo(ptConf confChain, ptListener listenerChain) {
|
|||
switch (choice)
|
||||
{
|
||||
case 1:
|
||||
system ("cls");
|
||||
{
|
||||
ptListener py = listenerChain;
|
||||
|
||||
while (py -> next != NULL) {
|
||||
|
@ -182,6 +215,7 @@ void menuAbo(ptConf confChain, ptListener listenerChain) {
|
|||
system("pause");
|
||||
menuAbo(confChain, listenerChain);
|
||||
break;
|
||||
}
|
||||
|
||||
case 2:
|
||||
{
|
||||
|
@ -226,10 +260,10 @@ void menuAbo(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/ Quitter"};
|
||||
system("cls");
|
||||
drawMenu(options, 6);
|
||||
goToCoords(0, 14);
|
||||
drawMenu(options, 5);
|
||||
goToCoords(0, 13);
|
||||
printf("Que voulez-vous faire ? : ");
|
||||
int choice;
|
||||
scanf("%d", &choice);
|
||||
|
@ -246,26 +280,46 @@ void menu(ptConf confChain, ptListener listenerChain)
|
|||
|
||||
case 3:
|
||||
{
|
||||
int confId, listenerId;
|
||||
int confId, listenerId, grade;
|
||||
printf("Entrez l'ID de la conference : ");
|
||||
scanf("%d", &confId);
|
||||
printf("Entrez l'ID du participant : ");
|
||||
scanf("%d", &listenerId);
|
||||
printf("Entrez la note attribuée par le participant : ");
|
||||
scanf("%d", &grade);
|
||||
|
||||
participateToConf(confChain, listenerChain, confId, listenerId);
|
||||
participateToConf(confChain, listenerChain, confId, listenerId, grade);
|
||||
saveRelations(confChain);
|
||||
menu(confChain, listenerChain);
|
||||
break;
|
||||
}
|
||||
|
||||
case 4:
|
||||
{
|
||||
ptConf px = confChain;
|
||||
int max = confGradeAvg(px);
|
||||
ptConf confMax = px;
|
||||
|
||||
while (px -> next != NULL) {
|
||||
int tmp = confGradeAvg(px);
|
||||
if (tmp > max) {
|
||||
confMax = px;
|
||||
max = tmp;
|
||||
}
|
||||
|
||||
px = px -> next;
|
||||
}
|
||||
|
||||
printf("La conférence la mieux notée est : %s\n\n", confMax -> title);
|
||||
|
||||
system("pause");
|
||||
menu(confChain, listenerChain);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 5:
|
||||
break;
|
||||
|
||||
case 6:
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue