diff --git a/FICHIERANGE/fonctionsCommande.c b/FICHIERANGE/fonctionsCommande.c index b1b9871..7286b75 100644 --- a/FICHIERANGE/fonctionsCommande.c +++ b/FICHIERANGE/fonctionsCommande.c @@ -5,10 +5,17 @@ int ajoutPanier(int TrefC[],int TquanC[],int nArticle,int Tref[], int n) { - int refP,code,quantite; + int refP,code,quantite,pos; printf("Saisir la référence du produit à ajouter au panier: "); scanf("%d",&refP); + pos = posRefC(TrefC,n,refP,nArticle,Tref); + if (pos != -1) + { + printf("L'article existe déja dans le panier."); + return nArticle; + } + code = posRef(Tref,refP,n); while (code == -1) { @@ -85,7 +92,7 @@ void affichPanier(int TrefC[],int TquanC[],int nArticle,int Tref[], float Tpoid[ printf("%.0f kg\n",chargeR); } -int posRefC(int TrefC[], float Tpoid[], int n, int refR,int nArticle,int Tref[]) +int posRefC(int TrefC[], int n, int refR,int nArticle,int Tref[]) { int i,pos; for (i=0;i 1) && rep != 9) + while ((rep < 0 || rep > 4) && rep != 9) { - printf("Erreur; (Ajout[0]/SupprimerArticle[1]/quitter[9]) "); + printf("Erreur; (Ajout[0]/ModifierArticle[1]/SupprimerArticle[2]/AfficherPanier[3]/ResetPanier[4]/quitter[9]) "); scanf("%d",&rep); } if (rep == 0) @@ -80,13 +80,28 @@ void testF(void) printf("\n"); } if (rep == 1) + { + ModifArticlePanier(TrefC,TquanC,nArticle,Tref,Tpoid,Tvolume,Tprix,n); + printf("\n"); + } + if (rep == 2) { nArticle = SupprArticlePanier(TrefC,TquanC,nArticle,Tref,Tpoid,Tvolume,Tprix,n); printf("\n"); } + if (rep == 3) + { + affichPanier(TrefC,TquanC,nArticle,Tref,Tpoid,Tvolume,Tprix,chargeV,volV,n); + printf("\n"); + } + if (rep == 4) + { + nArticle = ResetPanier(TrefC,TquanC,nArticle); + printf("\n"); + } if (rep != 9) { - printf("Que faire ? (Ajout[0]/SupprimerArticle[1]/quitter[9]) "); + printf("Que faire ? (Ajout[0]/ModifierArticle[1]/SupprimerArticle[2]/AfficherPanier[3]/ResetPanier[4]/quitter[9]) "); scanf("%d",&rep); }