|
|
|
@ -1,17 +1,11 @@
|
|
|
|
|
#include "main.h"
|
|
|
|
|
|
|
|
|
|
void inputClient(void)
|
|
|
|
|
void inputClient(int clientID[], float cagnotte[], int suspended[], int *tlog)
|
|
|
|
|
{
|
|
|
|
|
int numClient;
|
|
|
|
|
FILE *client;
|
|
|
|
|
client = fopen("client.txt", "a");
|
|
|
|
|
if (client == NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("Erreur lors de l'ouverture de 'client.txt'\n");
|
|
|
|
|
exit(1);
|
|
|
|
|
}
|
|
|
|
|
//A modif pour passer dans les tableaux mais pas les fichiers
|
|
|
|
|
int numClient = -1;
|
|
|
|
|
|
|
|
|
|
while (numClient)
|
|
|
|
|
while (numClient != 0)
|
|
|
|
|
{
|
|
|
|
|
printf("Entrez le numéro du client ou 0 si vous souhaitez arrêter la saisie: ");
|
|
|
|
|
scanf("%d", &numClient);
|
|
|
|
@ -20,15 +14,17 @@ void inputClient(void)
|
|
|
|
|
printf("Erreur, le numéro du client doit être positif, entrez le numéro du client ou 0 si vous souhaitez arrêter la saisie: ");
|
|
|
|
|
scanf("%d", &numClient);
|
|
|
|
|
}
|
|
|
|
|
fprintf(client, "%d\t0\t0", numClient);
|
|
|
|
|
clientID[*tlog] = numClient;
|
|
|
|
|
cagnotte[*tlog] = 0;
|
|
|
|
|
suspended[*tlog] = 0;
|
|
|
|
|
*tlog ++;
|
|
|
|
|
}
|
|
|
|
|
fclose(client);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void modifyClient(int clientID[], float cagnotte[], int suspended[], int tlog)
|
|
|
|
|
{
|
|
|
|
|
// à modifier dans un tableau, sauvegarde dans fichier avec fct de sauvegarde
|
|
|
|
|
int index, numClient, modif, montant;
|
|
|
|
|
int index, numClient, montant;
|
|
|
|
|
char modif;
|
|
|
|
|
printf("Entrez le numéro du client dont vous voulez modifier les données: ");
|
|
|
|
|
scanf("%d%*c", &numClient);
|
|
|
|
|
while (numClient < 0)
|
|
|
|
@ -57,19 +53,12 @@ void modifyClient(int clientID[], float cagnotte[], int suspended[], int tlog)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void inputItem(void)
|
|
|
|
|
void inputItem(int tabReference[], float tabWeight[], float tabVolume[], float unitPrice[], int *tlog)
|
|
|
|
|
{
|
|
|
|
|
int reference = 1;
|
|
|
|
|
//A modif pour passer dans les tableaux mais pas les fichiers
|
|
|
|
|
int reference = -1;
|
|
|
|
|
float weight, volume, price;
|
|
|
|
|
FILE *item;
|
|
|
|
|
item = fopen("article.txt", "a");
|
|
|
|
|
if (item == NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("Erreur lors de l'ouverture de 'article.txt'\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while (reference)
|
|
|
|
|
while (reference != 0)
|
|
|
|
|
{
|
|
|
|
|
printf("Entrez la référence du produit ou 0 si vous souhaitez arrêter la saisie: ");
|
|
|
|
|
scanf("%d", &reference);
|
|
|
|
@ -78,6 +67,7 @@ void inputItem(void)
|
|
|
|
|
printf("Erreur: la référence doit être positive, entrez la référence du produit ou 0 si vous souhaitez arrêter la saisie: ");
|
|
|
|
|
scanf("%d", &reference);
|
|
|
|
|
}
|
|
|
|
|
tabReference[*tlog] = reference;
|
|
|
|
|
|
|
|
|
|
printf("Entrez le poids du produit: ");
|
|
|
|
|
scanf("%f", &weight);
|
|
|
|
@ -86,6 +76,7 @@ void inputItem(void)
|
|
|
|
|
printf("Erreur, le poids doit être positif");
|
|
|
|
|
scanf("%f", &weight);
|
|
|
|
|
}
|
|
|
|
|
tabWeight[*tlog] = weight;
|
|
|
|
|
|
|
|
|
|
printf("Entrez le volume du produit: ");
|
|
|
|
|
scanf("%f", &volume);
|
|
|
|
@ -94,6 +85,7 @@ void inputItem(void)
|
|
|
|
|
printf("Erreur, le volume doit être positif");
|
|
|
|
|
scanf("%f", &volume);
|
|
|
|
|
}
|
|
|
|
|
tabVolume[*tlog] = volume;
|
|
|
|
|
|
|
|
|
|
printf("Entrez le prix du produit: ");
|
|
|
|
|
scanf("%f", &price);
|
|
|
|
@ -102,6 +94,8 @@ void inputItem(void)
|
|
|
|
|
printf("Erreur, le prix doit être positif");
|
|
|
|
|
scanf("%f", &price);
|
|
|
|
|
}
|
|
|
|
|
unitPrice[*tlog] = price;
|
|
|
|
|
|
|
|
|
|
*tlog++;
|
|
|
|
|
}
|
|
|
|
|
fclose(item);
|
|
|
|
|
}
|