basket summary really works

Signed-off-by: Mathéo Hersan <matheohersan@MacBook-Pro-de-Matheo.local>
pull/2/head
Mathéo Hersan 2 years ago
parent 966b93a150
commit d966c1bc35
No known key found for this signature in database
GPG Key ID: 4EF19C64D78EC91B

BIN
app

Binary file not shown.

@ -141,7 +141,7 @@ void affiche_recap_panier(int panier[], int taillePanier, int references[], floa
for (int i = 0; i < taillePanier; i++) { for (int i = 0; i < taillePanier; i++) {
int reference = panier[i]; int reference = panier[i];
int articleIndex = -1; int articleIndex = -1;
for (int j = 0; j < taillePanier; j++) { for (int j = 0; j < MAX_ARTICLES; j++) {
if (references[j] == reference) { if (references[j] == reference) {
articleIndex = j; articleIndex = j;
break; break;
@ -158,14 +158,13 @@ void affiche_recap_panier(int panier[], int taillePanier, int references[], floa
float prixArticle = prixUnitaire[articleIndex]; float prixArticle = prixUnitaire[articleIndex];
int quantite = quantites[i]; int quantite = quantites[i];
printf("%d\t %d\t %.2f\t %.2f\t %.2f\t %.2f\t %.2f\t %.2f\n", printf("%d\t %d\t %.2f\t %.2f\t %.2f\t %.2f\t %.2f\t %.2f\n",
reference, quantite, poidsArticle, volumeArticle, reference, quantite, poidsArticle, volumeArticle,
prixArticle, poidsArticle, volumeArticle, prixArticle); prixArticle, poidsArticle * quantite, volumeArticle * quantite, prixArticle * quantite);
poidsTotal += poidsArticle; poidsTotal += poidsArticle * quantite;
volumeTotal += volumeArticle; volumeTotal += volumeArticle * quantite;
montantTotal += prixArticle; montantTotal += prixArticle * quantite;
} }
printf("Prix total à payer: %.2f euros\n", montantTotal); printf("Prix total à payer: %.2f euros\n", montantTotal);

@ -76,7 +76,7 @@ void global_client() {
return; return;
} }
if (suspendus[indexClient] == 0) { if (suspendus[indexClient] == 1) {
printf("Le client est suspendu et ne peut pas utiliser l'application.\n"); printf("Le client est suspendu et ne peut pas utiliser l'application.\n");
return; return;
} }

Loading…
Cancel
Save