|
|
|
@ -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 i;
|
|
|
|
|
for (i=0, i<tlog, i++)
|
|
|
|
|
for (i=0; i<tlog; i++)
|
|
|
|
|
{
|
|
|
|
|
if (tab[i] == val)
|
|
|
|
|
return i;
|
|
|
|
@ -94,13 +94,13 @@ int chargeClients(int clientID[], float cagnotte[], int suspended[])
|
|
|
|
|
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);
|
|
|
|
|
*tLogClient = sauvegardeClients(clientID, cagnotte, suspended);
|
|
|
|
|
sauvegardeArticles(reference, weight, volume, unitPrice, tLogArticle);
|
|
|
|
|
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;
|
|
|
|
|
article = fopen("articles.txt","w");
|
|
|
|
@ -117,10 +117,9 @@ int sauvegardeArticles(int reference[], float weight[], float volume[], float un
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fclose(article);
|
|
|
|
|
return tLogArticle;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int sauvegardeClients(int clientID[], float cagnotte[], int suspended[])
|
|
|
|
|
void sauvegardeClients(int clientID[], float cagnotte[], int suspended[], int tLogClient)
|
|
|
|
|
{
|
|
|
|
|
FILE *client;
|
|
|
|
|
client = fopen("clients.txt","w");
|
|
|
|
@ -137,5 +136,4 @@ int sauvegardeClients(int clientID[], float cagnotte[], int suspended[])
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fclose(client);
|
|
|
|
|
return tLogClient;
|
|
|
|
|
}
|