better code when we quit the app

Signed-off-by: Mathéo Hersan <matheohersan@MacBook-Pro-de-Matheo.local>
pull/13/head
Mathéo Hersan 1 year ago
parent c2d1e3da99
commit 9fe88862b8
No known key found for this signature in database
GPG Key ID: 4EF19C64D78EC91B

BIN
app

Binary file not shown.

@ -1,4 +1,4 @@
32 36.40 1 32 69.00 1
660 5419.20 0 660 5319.40 0
5079 75.50 0 5079 75.50 0
53 0.00 0 53 0.00 0

@ -92,8 +92,8 @@ void verifInt(int *var) {
void verifFloat(float *var) { void verifFloat(float *var) {
while (scanf("%f", var) != 1 || *var < -0) { while (scanf("%f", var) != 1 || *var < 0) {
while (getchar() != '\n');
fprintf(stderr, "\x1B[31mERREUR : Veuillez entrer une valeur valide (valeur positive) :\x1B[0m "); fprintf(stderr, "\x1B[31mERREUR : Veuillez entrer une valeur valide (valeur positive) :\x1B[0m ");
while (getchar() != '\n');
} }
} }

@ -318,6 +318,13 @@ void quitter_application(int tPanier[], int tLogPanier, int tRef[], float tPoid[
if(tSus[clientIndex] == 1 && budget > 0 && montantTotal < budget) { if(tSus[clientIndex] == 1 && budget > 0 && montantTotal < budget) {
printf("Vous ne pourrez pas utiliser votre cagnotte car votre carte est suspendu.\n"); printf("Vous ne pourrez pas utiliser votre cagnotte car votre carte est suspendu.\n");
printf("Payement effectué.\n");
return;
}
if(tSus[clientIndex] == 1) {
printf("Vous ne pourrez pas utiliser votre cagnotte car votre carte est suspendu.\n");
printf("Payement effectué.\n");
return; return;
} }
@ -350,6 +357,7 @@ void quitter_application(int tPanier[], int tLogPanier, int tRef[], float tPoid[
verifFloat(&montantDeduction); verifFloat(&montantDeduction);
} }
deduire_cagnotte(numClient, montantDeduction, tNumClient, tCagnotte, tLogClient); deduire_cagnotte(numClient, montantDeduction, tNumClient, tCagnotte, tLogClient);
printf("Payement effectué.\n");
return; return;
} else { } else {
printf("Payement non effectué.\n"); printf("Payement non effectué.\n");
@ -367,7 +375,9 @@ void quitter_application(int tPanier[], int tLogPanier, int tRef[], float tPoid[
printf("Entrez le montant à déduire de votre cagnotte : "); printf("Entrez le montant à déduire de votre cagnotte : ");
verifFloat(&montantDeduction); verifFloat(&montantDeduction);
deduire_cagnotte(numClient, montantDeduction, tNumClient, tCagnotte, tLogClient); deduire_cagnotte(numClient, montantDeduction, tNumClient, tCagnotte, tLogClient);
} printf("Payement effectué.\n");
} else {
printf("Payement effectué.\n");
} }
void menu_client(int *choix) { void menu_client(int *choix) {

Loading…
Cancel
Save