Added chargerClient

pull/2/head
Matheo HERSAN 2 years ago
parent 75be045592
commit 26889a4ee5

@ -4,21 +4,20 @@
#include "client.h" #include "client.h"
void afficherDonneesClient() { void chargerClient(int tNumClient[], float tCagnotte[], int tSus[], int *tLogique)
FILE *fichier = fopen("donnee/client.txt", "r"); {
int numeroClient; FILE *fic;
float cagnotte; int i;
int suspendu; fic = fopen("donnee/client.txt", "r");
if (fic == NULL)
if (fichier == NULL) { {
fprintf(stderr, "Erreur lors de l'ouverture du fichier"); perror("fopen");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
while (fscanf(fichier, "%d%f%d", &numeroClient, &cagnotte, &suspendu) == 3) { while (fscanf(fic, "%d %f %d", &tNumClient[*tLogique], &tCagnotte[*tLogique], &tSus[*tLogique]) != EOF)
printf("Client %d, Cagnotte %.2f, Suspendu: %s\n", {
numeroClient, cagnotte, (suspendu == 0) ? "Non" : "Oui"); (*tLogique)++;
} }
fclose(fic);
fclose(fichier);
} }

@ -8,6 +8,6 @@
#include<stdio.h> #include<stdio.h>
#include<stdlib.h> #include<stdlib.h>
void afficherDonneesClient(); void chargerClient(int tNumClient[], float tCagnotte[], int tSus[], int *tLogique);
#endif //SAE_101_CLIENT_H #endif //SAE_101_CLIENT_H

@ -26,5 +26,7 @@ int main(){
//case 1: global_resp(); //case 1: global_resp();
case 2: global_client(); case 2: global_client();
} }
chargerClient();
return 0; return 0;
} }

Loading…
Cancel
Save