From 3325bab4056829b227b81f5d7c024d1cff216c37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20LAVERGNE?= Date: Tue, 7 Nov 2023 00:28:33 +0100 Subject: [PATCH] =?UTF-8?q?Cr=C3=A9ation=20des=20fonctions=20de=20d=C3=A9b?= =?UTF-8?q?ug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/debug.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 src/debug.c diff --git a/src/debug.c b/src/debug.c new file mode 100644 index 0000000..9bfc9f6 --- /dev/null +++ b/src/debug.c @@ -0,0 +1,51 @@ +/** + * @file debug.c + * @brief Gestion du mode debug +*/ + +#include "main.h" + +void displayItemList(int reference[], float weight[], float volume[], float unitPrice[], int log) +{ + int i; + printf("DEBUG - Affichage des articles: \n"); + for (i = 0; i < log; i++) + { + printf("Référence: %d, Poids: %f, Volume: %f, Prix unitaire: %f\n", reference[i], weight[i], volume[i], unitPrice[i]); + } +} + +void displayClientList(int clientID[], float cagnotte[], int suspended[], int isAdmin[], int log) +{ + int i; + printf("DEBUG - Affichage des clients: \n"); + for (i = 0; i < log; i++) + { + printf("Identifiant: %d, Cagnotte: %f, Suspendu: %d, Admin: %d\n", clientID[i], cagnotte[i], suspended[i], isAdmin[i]); + } +} + +void debugMenu(int tabReference[], float tabWeight[], float tabVolume[], float unitPrice[], int clientID[], float cagnotte[], int suspended[], int isAdmin[], int tlogArticle, int tlogClient) +{ + int choice = -1; + while (choice != 0) + { + printf("DEBUG - Menu de debug: \n"); + printf("1 - Afficher les articles\n"); + printf("2 - Afficher les clients\n"); + printf("Votre choix: "); + scanf("%d%*c", &choice); + + switch (choice) + { + case 1: + displayItemList(tabReference, tabWeight, tabVolume, unitPrice, tlogArticle); + break; + case 2: + displayClientList(clientID, cagnotte, suspended, isAdmin, tlogClient); + break; + default: + break; + } + } +} \ No newline at end of file