ADD chargementArticles()

pull/2/head
Yannis DOUMIR FERNANDES 2 years ago committed by Mathéo Hersan
parent 26889a4ee5
commit 62203ccd46
No known key found for this signature in database
GPG Key ID: 4EF19C64D78EC91B

@ -0,0 +1,27 @@
#include <stdio.h>
#include "responsable.h"
int chargementArticles(int tRef[], float tPoids[], float tVol[], float tPrix[], float tPhysique)
{
int i=0, ref;
float volume, poids, prix;
FILE * fe;
fe = fopen("donnee/articles.txt", "r");
if ( fe == NULL)
{
perror("fopen");
}
while ( fscanf(fe,"%d %f %f %f", &ref, &poids, &volume, &prix) == 4)
{
if ( i == tPhysique )
{
fprintf(stderr,"Tableau plein");
}
tRef[i] = ref;
tPoids[i] = poids;
tVol[i] = volume;
tPrix[i] = prix;
i++;
}
return i;
}

@ -0,0 +1,3 @@
int chargementArticles(int tRef[], float tPoids[], float tVol[], float tPrix[], float tPhysique);

@ -0,0 +1,12 @@
#include <stdio.h>
#include "responsable.h"
#include "../interface/interface_resp.h"
int main (void)
{
int tPhysique = 10, tRef[10], tLogique = 0;
float tPoids[10], tVol[10], tPrix[10];
tLogique = chargementArticles( tRef, tPoids, tVol, tPrix, tPhysique);
affichArticles( tRef, tPoids, tVol, tPrix, tLogique);
return 0;
}

@ -1,12 +1,12 @@
#include <stdio.h>
#include "interface_resp.h"
void affichArticles( int tRef[], float tPoids[], float tVol[], float tPrix[], int tPhysique)
void affichArticles( int tRef[], float tPoids[], float tVol[], float tPrix[], int tLogique)
{
int i;
printf("______________________________________\n");
printf("\t Liste des articles \n\n");
for ( i = 0; i < tPhysique; ++i)
for ( i = 0; i < tLogique; ++i)
{
printf("\t %d %.2f %.2f %.2f\n\n", tRef[i], tPoids[i], tVol[i], tPrix[i]);
}

@ -1,4 +1,4 @@
void affichArticles( int tRef[], float tPoids[], float tVol[], float tPrix[], int tPhysique);
void affichArticles( int tRef[], float tPoids[], float tVol[], float tPrix[], int tLogique);
void affichUnArticle(int tRef[], float tPoids[], float tVol[], float tPrix[], int tLogique, int val);
void affichUnClient(int tNumClient[], float tCagnotte[], int tSus[], int tLogique, int val);
void affichUnClients(int tNumClient[], float tCagnotte[], int tSus[], int tLogique, int val);
Loading…
Cancel
Save