parent
748ae23661
commit
273702c2d5
@ -1,4 +1,4 @@
|
|||||||
#include "ange.h"
|
#include "fonctionsArticle.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
@ -0,0 +1,58 @@
|
|||||||
|
#include "fonctionsCommande.h"
|
||||||
|
#include "fonctionsArticle.h"
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int ajoutPanier(int TrefC[],int TquanC[],int nArticle,int Tref[], int n)
|
||||||
|
{
|
||||||
|
int refP,code,quantite;
|
||||||
|
printf("Saisir la référence du produit à ajouter au panier: ");
|
||||||
|
scanf("%d",&refP);
|
||||||
|
|
||||||
|
code = posRef(Tref,refP,n);
|
||||||
|
while (code == -1)
|
||||||
|
{
|
||||||
|
printf("Erreur ; Cette référence n'existe pas dans la base de donnée; retapez : ");
|
||||||
|
scanf("%d",&refP);
|
||||||
|
code = posRef(Tref,refP,n);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("Saisir la quantité souhaité pour le produit: ");
|
||||||
|
scanf("%d",&quantite);
|
||||||
|
while (quantite < 1)
|
||||||
|
{
|
||||||
|
printf("Erreur ; La quantité peut seulement être positive; retapez : ");
|
||||||
|
scanf("%d",&quantite);
|
||||||
|
}
|
||||||
|
printf("\nRéférence : %d\n",refP);
|
||||||
|
printf("Quantité : %d\n",quantite);
|
||||||
|
TrefC[nArticle] = refP;
|
||||||
|
TquanC[nArticle] = quantite;
|
||||||
|
return nArticle +=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void affichPanier(int TrefC[],int TquanC[],int nArticle,int Tref[], float Tpoid[],float Tvolume[],float Tprix[],int n)
|
||||||
|
{
|
||||||
|
printf("\nRéf\tQté\tPoids\tVol\tPrixU\tPoidsTot\tVolTot\tPrixTot\tCagnotte\n");
|
||||||
|
int i, pos,cagnotte;
|
||||||
|
float prixtot;
|
||||||
|
int cfinal=0;
|
||||||
|
float prixfinal=0,volfinal=0,chargefinal=0;
|
||||||
|
for (i=0;i <nArticle;i++)
|
||||||
|
{
|
||||||
|
pos = posRef(Tref,TrefC[i],n);
|
||||||
|
prixtot=Tprix[pos]*TquanC[i];
|
||||||
|
cagnotte=prixtot*0.1;
|
||||||
|
prixfinal+=prixtot;
|
||||||
|
cfinal+=cagnotte;
|
||||||
|
volfinal+=Tvolume[pos];
|
||||||
|
chargefinal+=Tpoid[pos];
|
||||||
|
printf("%d\t%d\t%.3f\t%.2f\t%.2f\t%.3f\t%.2f\t%.2f\t%d\n",TrefC[i],TquanC[i],Tpoid[pos],Tvolume[pos],Tprix[pos],Tprix[pos]*TquanC[i],Tvolume[pos]*TquanC[i],prixtot,cagnotte);
|
||||||
|
}
|
||||||
|
printf("\n\t\t\t\t\t\tPrix total à payer:\t%.2f\n",prixfinal);
|
||||||
|
printf("\t\t\t\t\t\tCagnotte totale:\t%d\n",cfinal);
|
||||||
|
printf("Volume utilisé: %.2f\n",volfinal);
|
||||||
|
printf("Volume restant: %.2f\n",volfinal);
|
||||||
|
printf("Charge Actuelle: %.2f\n",chargefinal);
|
||||||
|
printf("Charge restante: %.2f\n",chargefinal);
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
int ajoutPanier(int TrefC[],int TquanC[],int nArticle,int Tref[], int n);
|
||||||
|
void affichPanier(int TrefC[],int TquanC[],int nArticle,int Tref[], float Tpoid[],float Tvolume[],float Tprix[],int n);
|
Binary file not shown.
@ -0,0 +1,91 @@
|
|||||||
|
#include "fonctionsArticle.h"
|
||||||
|
#include "fonctionsCommande.h"
|
||||||
|
|
||||||
|
void testF(void)
|
||||||
|
{
|
||||||
|
int n=0,rep;
|
||||||
|
int Tref[100]={0};
|
||||||
|
float Tpoid[100]={0},Tvolume[100]={0},Tprix[100]={0};
|
||||||
|
n = TableArticle(Tref,Tpoid,Tvolume,Tprix);
|
||||||
|
|
||||||
|
printf("Responsable / Client ? (R[0]/C[1])");
|
||||||
|
scanf("%d",&rep);
|
||||||
|
if (rep == 0)
|
||||||
|
{
|
||||||
|
printf("Bienvenue Mr. le responsable :)\n");
|
||||||
|
printf("Que voulez vous faire ? (afficher[0]/ajouter[1]/modifier[2]/supprimer[3]/quitter[-1]) ");
|
||||||
|
scanf("%d",&rep);
|
||||||
|
while (rep != -1)
|
||||||
|
{
|
||||||
|
while (rep < -1 || rep > 3)
|
||||||
|
{
|
||||||
|
printf("Erreur; (afficher[0]/ajouter[1]/modifier[2]/supprimer[3]/quitter[-1]) ");
|
||||||
|
scanf("%d",&rep);
|
||||||
|
}
|
||||||
|
if (rep == 0)
|
||||||
|
{
|
||||||
|
AffichTable(Tref,Tpoid,Tvolume,Tprix,n);
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
if (rep == 1)
|
||||||
|
{
|
||||||
|
AjoutArticle();
|
||||||
|
n = TableArticle(Tref,Tpoid,Tvolume,Tprix);
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
if (rep == 2)
|
||||||
|
{
|
||||||
|
ModifArticle(Tref,Tpoid,Tvolume,Tprix,n);
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
if (rep == 3)
|
||||||
|
{
|
||||||
|
n = SupprArticle(Tref,Tpoid,Tvolume,Tprix,n);
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
printf("Que faire ? (afficher[0]/ajouter[1]/modifier[2]/supprimer[3]/quitter[-1]) ");
|
||||||
|
scanf("%d",&rep);
|
||||||
|
if (rep == -1)
|
||||||
|
{
|
||||||
|
EcrireFichier(Tref,Tpoid,Tvolume,Tprix,n);
|
||||||
|
printf("Au revoir !\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("Bienvenue Mr. le client :)\n");
|
||||||
|
printf("Que voulez vous faire ? (Ajout[0]/quitter[-1]) ");
|
||||||
|
scanf("%d",&rep);
|
||||||
|
int TrefC[200]={0},TquanC[200]={0},nArticle=0;
|
||||||
|
while (rep != -1)
|
||||||
|
{
|
||||||
|
while (rep < -1 || rep > 0)
|
||||||
|
{
|
||||||
|
printf("Erreur; (Ajout[0]/quitter[-1]) ");
|
||||||
|
scanf("%d",&rep);
|
||||||
|
}
|
||||||
|
if (rep == 0)
|
||||||
|
{
|
||||||
|
nArticle = ajoutPanier(TrefC,TquanC,nArticle,Tref,n);
|
||||||
|
affichPanier(TrefC,TquanC,nArticle,Tref,Tpoid,Tvolume,Tprix,n);
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("Que faire ? (Ajout[0]/quitter[-1]) ");
|
||||||
|
scanf("%d",&rep);
|
||||||
|
if (rep == -1)
|
||||||
|
{
|
||||||
|
printf("Au revoir !\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
testF();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
@ -1,56 +0,0 @@
|
|||||||
#include "ange.h"
|
|
||||||
|
|
||||||
void testF(void)
|
|
||||||
{
|
|
||||||
int n=0,rep;
|
|
||||||
int Tref[100]={0};
|
|
||||||
float Tpoid[100]={0},Tvolume[100]={0},Tprix[100]={0};
|
|
||||||
|
|
||||||
printf("Bienvenue Mr. le directeur :)\n");
|
|
||||||
n = TableArticle(Tref,Tpoid,Tvolume,Tprix);
|
|
||||||
|
|
||||||
printf("Que voulez vous faire ? (afficher[0]/ajouter[1]/modifier[2]/supprimer[3]/quitter[-1]) ");
|
|
||||||
scanf("%d",&rep);
|
|
||||||
while (rep != -1)
|
|
||||||
{
|
|
||||||
while (rep < -1 || rep > 3)
|
|
||||||
{
|
|
||||||
printf("Erreur; (afficher[0]/ajouter[1]/modifier[2]/supprimer[3]/quitter[-1]) ");
|
|
||||||
scanf("%d",&rep);
|
|
||||||
}
|
|
||||||
if (rep == 0)
|
|
||||||
{
|
|
||||||
AffichTable(Tref,Tpoid,Tvolume,Tprix,n);
|
|
||||||
printf("\n");
|
|
||||||
}
|
|
||||||
if (rep == 1)
|
|
||||||
{
|
|
||||||
AjoutArticle();
|
|
||||||
n = TableArticle(Tref,Tpoid,Tvolume,Tprix);
|
|
||||||
printf("\n");
|
|
||||||
}
|
|
||||||
if (rep == 2)
|
|
||||||
{
|
|
||||||
ModifArticle(Tref,Tpoid,Tvolume,Tprix,n);
|
|
||||||
printf("\n");
|
|
||||||
}
|
|
||||||
if (rep == 3)
|
|
||||||
{
|
|
||||||
n = SupprArticle(Tref,Tpoid,Tvolume,Tprix,n);
|
|
||||||
printf("\n");
|
|
||||||
}
|
|
||||||
printf("Que faire ? (afficher[0]/ajouter[1]/modifier[2]/supprimer[3]/quitter[-1]) ");
|
|
||||||
scanf("%d",&rep);
|
|
||||||
if (rep == -1)
|
|
||||||
{
|
|
||||||
EcrireFichier(Tref,Tpoid,Tvolume,Tprix,n);
|
|
||||||
printf("Au revoir !\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
testF();
|
|
||||||
return 0;
|
|
||||||
}
|
|
Loading…
Reference in new issue