|
|
|
@ -36,18 +36,17 @@ void sauvegardArticles(int tRef[], float tPoids[], float tVol[], float tPrix[],
|
|
|
|
|
fe = fopen("donnee/articles.txt", "w");
|
|
|
|
|
if ( fe == NULL)
|
|
|
|
|
{
|
|
|
|
|
perror("fopen");
|
|
|
|
|
fprintf(stderr, "\n Problème ouverture ficher\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for ( i = 0; i < tLogique; i++)
|
|
|
|
|
{
|
|
|
|
|
fprintf(fe,"%d %f %f %f\n", tRef[i], tPoids[i], tVol[i], tPrix[i]);
|
|
|
|
|
fprintf(fe,"\t %d\t %.2f\t %.2f\t %.2f\n", tRef[i], tPoids[i], tVol[i], tPrix[i]);
|
|
|
|
|
}
|
|
|
|
|
fclose(fe);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int ajouterArticle( int tRef[], float tPoids[], float tVol[], float tPrix[], int *tLogique, int tPhysique, int ref, float poids, float volume, float prix)
|
|
|
|
|
{
|
|
|
|
|
int i = *tLogique;
|
|
|
|
@ -57,14 +56,12 @@ int ajouterArticle( int tRef[], float tPoids[], float tVol[], float tPrix[], int
|
|
|
|
|
fprintf(stderr,"Tableau plein !");
|
|
|
|
|
return -2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// SI on trie pas par ref c'est ca
|
|
|
|
|
tRef[i] = ref;
|
|
|
|
|
tPoids[i] = poids;
|
|
|
|
|
tVol[i] = volume;
|
|
|
|
|
tPrix[i] = prix;
|
|
|
|
|
(*tLogique)++;
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void rechercheRefArticle(int tRef[], int ref, int *index, int tLogique)
|
|
|
|
@ -77,19 +74,18 @@ void rechercheRefArticle(int tRef[], int ref, int *index, int tLogique)
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
fprintf(stderr, "\t Article non trouvé.\n");
|
|
|
|
|
*index = -1;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void supprimerArticle(int tRef[], float tPoids[], float tVol[], float tPrix[], int *tLogique)
|
|
|
|
|
{
|
|
|
|
|
int ref, index;
|
|
|
|
|
affichSupprimerArticle(&ref);
|
|
|
|
|
rechercheRefArticle(tRef, ref, &index, *tLogique);
|
|
|
|
|
|
|
|
|
|
for( int i = index; i< *tLogique-1; ++i)
|
|
|
|
|
for( int i = index; i < *tLogique-1; ++i)
|
|
|
|
|
{
|
|
|
|
|
tRef[i] = tRef[i+1];
|
|
|
|
|
tPoids[i] = tPoids[i+1];
|
|
|
|
@ -110,4 +106,17 @@ void modifierArticle(int tRef[], float tPoids[], float tVol[], float tPrix[], in
|
|
|
|
|
tVol[index] = volume;
|
|
|
|
|
tPrix[index] = prix;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ajouterClient(int tNumClient[], float tCagnotte[], int tSus[], int *tLogique, int tPhysique)
|
|
|
|
|
{
|
|
|
|
|
int numC = 0;
|
|
|
|
|
affichAjoutClient(tNumClient, *tLogique, &numC);
|
|
|
|
|
|
|
|
|
|
tNumClient[*tLogique] = numC;
|
|
|
|
|
tCagnotte[*tLogique] = 0;
|
|
|
|
|
tSus[*tLogique] = 0;
|
|
|
|
|
(*tLogique)++;
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
}
|