réglage de divers bugs

doc
louis.germain 2 years ago
parent 984fe2225f
commit cc46697f12

@ -1,17 +1,17 @@
#include "main.h" #include "main.h"
void displayItem(int reference[], float weight[], float volume[], float unitPrice[], int tlog) void displayItem(int tabReference[], float weight[], float volume[], float unitPrice[], int tlog)
{ {
int reference, index; int reference, index;
printf("Entrez la référence de l'article cherché: "); printf("Entrez la référence de l'article cherché: ");
scanf("%d", &reference); scanf("%d", &reference);
index = recherche(reference, reference[], tlog); index = recherche(reference, tabReference, tlog);
if (index == -1) if (index == -1)
{ {
printf("La référence cherchée n'existe pas"); printf("La référence cherchée n'existe pas");
exit(1); exit(1);
} }
printf("%d\t%f\t%f\t%f", reference[index], weight[index], volume[index], unitPrice[index]); printf("%d\t%f\t%f\t%f", tabReference[index], weight[index], volume[index], unitPrice[index]);
} }
void displayItemList(int reference[], float weight[], float volume[], float unitPrice[], int tlog) void displayItemList(int reference[], float weight[], float volume[], float unitPrice[], int tlog)

@ -16,13 +16,13 @@ void chargeDonnees(int *tLogArticle, int *tLogClient,int reference[], float weig
int chargeArticles(int reference[], float weight[], float volume[], float unitPrice[]); int chargeArticles(int reference[], float weight[], float volume[], float unitPrice[]);
int chargeClients(int clientID[], float cagnotte[], int suspended[]); int chargeClients(int clientID[], float cagnotte[], int suspended[]);
void sauvegardeDonnees(int *tLogArticle, int *tLogClient, int reference[], float weight[], float volume[], float unitPrice[], int clientID[], float cagnotte[], int suspended[]); void sauvegardeDonnees(int tLogArticle, int tLogClient, int reference[], float weight[], float volume[], float unitPrice[], int clientID[], float cagnotte[], int suspended[]);
void sauvegardeArticles(int reference[], float weight[], float volume[], float unitPrice[]); void sauvegardeArticles(int reference[], float weight[], float volume[], float unitPrice[], int tLogArticle);
void sauvegardeClients(int clientID[], float cagnotte[], int suspended[]); void sauvegardeClients(int clientID[], float cagnotte[], int suspended[], int tLogClient);
//! GESTION CLIENTS //! GESTION CLIENTS
void inputClient(void); void inputClient(void);
void modifyClient(void); void modifyClient(int clientID[], float cagnotte[], int suspended[], int tlog);
//! GESTION STOCKS //! GESTION STOCKS
void inputItem(void); void inputItem(void);

@ -33,7 +33,7 @@ void modifyClient(int clientID[], float cagnotte[], int suspended[], int tlog)
scanf("%d%*c", &numClient); scanf("%d%*c", &numClient);
index = recherche(numClient, clientID, tlog); index = recherche(numClient, clientID, tlog);
printf("Entrez la modification voulue (s pour suspendre ou réactiver, c pour ajouter à la cagnotte)"); printf("Entrez la modification voulue (s pour suspendre ou réactiver, c pour ajouter à la cagnotte)");
scanf("%c"; &modif); scanf("%c", &modif);
if (modif == 's') if (modif == 's')
if (suspended[index] == 0) if (suspended[index] == 0)
suspended[index] = 1; suspended[index] = 1;

@ -9,7 +9,7 @@
int recherche(int val, int tab[], int tlog) // Recherche de l'index d'un id (de client ou d'article) int recherche(int val, int tab[], int tlog) // Recherche de l'index d'un id (de client ou d'article)
{ {
int i; int i;
for (i=0, i<tlog, i++) for (i=0; i<tlog; i++)
{ {
if (tab[i] == val) if (tab[i] == val)
return i; return i;
@ -94,13 +94,13 @@ int chargeClients(int clientID[], float cagnotte[], int suspended[])
return tL; return tL;
} }
void sauvegardeDonnees(int *tLogArticle, int *tLogClient, int reference[], float weight[], float volume[], float unitPrice[], int clientID[], float cagnotte[], int suspended[]) void sauvegardeDonnees(int tLogArticle, int tLogClient, int reference[], float weight[], float volume[], float unitPrice[], int clientID[], float cagnotte[], int suspended[])
{ {
*tLogArticle = sauvegardeArticles(reference, weight, volume, unitPrice); sauvegardeArticles(reference, weight, volume, unitPrice, tLogArticle);
*tLogClient = sauvegardeClients(clientID, cagnotte, suspended); sauvegardeClients(clientID, cagnotte, suspended, tLogClient);
} }
int sauvegardeArticles(int reference[], float weight[], float volume[], float unitPrice[]) void sauvegardeArticles(int reference[], float weight[], float volume[], float unitPrice[], int tLogArticle)
{ {
FILE *article; FILE *article;
article = fopen("articles.txt","w"); article = fopen("articles.txt","w");
@ -117,10 +117,9 @@ int sauvegardeArticles(int reference[], float weight[], float volume[], float un
} }
fclose(article); fclose(article);
return tLogArticle;
} }
int sauvegardeClients(int clientID[], float cagnotte[], int suspended[]) void sauvegardeClients(int clientID[], float cagnotte[], int suspended[], int tLogClient)
{ {
FILE *client; FILE *client;
client = fopen("clients.txt","w"); client = fopen("clients.txt","w");
@ -137,5 +136,4 @@ int sauvegardeClients(int clientID[], float cagnotte[], int suspended[])
} }
fclose(client); fclose(client);
return tLogClient;
} }
Loading…
Cancel
Save