From 2f669c508af5209a0ffe984fb7fe11374878c4b3 Mon Sep 17 00:00:00 2001 From: Roxane ROSSETTO Date: Mon, 7 Nov 2022 13:08:50 +0100 Subject: [PATCH] =?UTF-8?q?Modification=20dossier,=20cr=C3=A9ation=20main?= =?UTF-8?q?=20commun,=20creation=20.h=20commun?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SAE algo/test | Bin 16960 -> 0 bytes SAE algo/testrox.c | 11 ---------- SAE algo/fRox.c => fRox.c | 43 ++++++++++++++++++++++++++++---------- SAE algo/fRox.h => fRox.h | 4 +++- hCommun.h | 1 + maincommun.c | 1 + testrox.c | 13 ++++++++++++ 7 files changed, 50 insertions(+), 23 deletions(-) delete mode 100755 SAE algo/test delete mode 100644 SAE algo/testrox.c rename SAE algo/fRox.c => fRox.c (55%) rename SAE algo/fRox.h => fRox.h (56%) create mode 100644 hCommun.h create mode 100644 maincommun.c create mode 100644 testrox.c diff --git a/SAE algo/test b/SAE algo/test deleted file mode 100755 index ce5d9b1cfa1f95516d304a3e2d9a49c0bfe50aca..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16960 zcmeHOZERcB89t8tk(Sm;X$$Gc*1N79EhuhMXqy5Vb`rNYEGb<`y1{5KPJErXbL`B% zE-9>9w?H*71d13MKbXcee$ahrFl`f)K!mnxflX733ad6?87rC#tVvrLUqGD;4hrlHcP>Uy93>9V7RUko=}AebgZoMxn+*eltm- z)v?Hx_G2E9!q2fYX=)P)^5DUpHBMM%W*G4^K=TgZtD`+j%$uR@S;EKHJ5zn zmRV15C5%|^N>oQR5n zjFlDxsaV2_ifB(fnKoh3GZ;3au|zl?yOTtm$Q~nYg;SQ%AC4si$#fn!imh#}P0hx7 z|E5B1y?=u+T07f~h?z2bV`QwkT=Id@?fz6Mr>y-IA#p?lE&pgYgZ?Jiq zYjm!-j5&Dud8HIN2k*S@#vMF5S|}3^er|ykq9$MqG!G~fT(p2)BVK(JN@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cp`*1I%LPN_P$#{o_FvKBPE;tT?9cb@jHAks+bn6$Qqwu)h-vbJt-zr~;0v#MAeX9|!k`KY!`^;J!QDMFTB7QTCMt=XPx^ UtqIEe|7x>sLF+1KDG|kg0E6tPfB*mh diff --git a/SAE algo/testrox.c b/SAE algo/testrox.c deleted file mode 100644 index cbc23ae..0000000 --- a/SAE algo/testrox.c +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include "fRox.h" -#define TAILLE 500 - -void main(void) -{ int *tNoClient, *tAge, toto; - char *tNomClient, *tPreClient, *tStatut; - - toto =fchargement(tNoClient, tNomClient, tPreClient, tAge, tStatut, 50); - printf("%d\n", toto); -} \ No newline at end of file diff --git a/SAE algo/fRox.c b/fRox.c similarity index 55% rename from SAE algo/fRox.c rename to fRox.c index 34089b0..8fb6234 100644 --- a/SAE algo/fRox.c +++ b/fRox.c @@ -1,22 +1,22 @@ #include #include "fRox.h" -#define TAILLE 500 + //Fonction de chargement depuis le dossier client. Return 0 si dossier introuvable ou tableau plein, return i nombre d'éléments chargés -int fchargement(int *tNoClient, char *tNomClient, char *tPreClient, int *tAge, char *tStatut, int tmax) +int fchargement(int *tNoClient, char *tNomClient, char *tPreClient, int *tAge, int *tCActiv, int *tActivite, int *tPasseouPas,int *tPtsBought, int *tPtsBonus, char *tCat, int tmax) { - int noC, age, i=0; - char prenom, nom, statut; + int noC, age, carte, activite, passage, ptsA, ptsB, i=0; + char prenom, nom, categorie; FILE *fe; - fe = fopen ("donneClient.don", "r"); + fe = fopen ("donneeClient.don", "r"); if (fe == NULL) { printf("Le fichier est introuvable\n"); return 0; - fscanf(fe,"%d%c%c%d%c", &noC, &nom, &prenom, &age, &statut); + fscanf(fe,"%d%c%c%d%d%d%d%d%c", &noC, &nom, &prenom, &age, &carte, &activite, &passage, &ptsA, &ptsB, &categorie); while(!feof(fe)) { @@ -30,9 +30,14 @@ int fchargement(int *tNoClient, char *tNomClient, char *tPreClient, int *tAge, c tNomClient[i] = nom; tPreClient[i] = prenom; tAge[i] = age; - tStatut[i] = statut; + tCat[i] = categorie; + tCActiv[i] = carte; + tActivite[i] = activite; + tPasseouPas[i] = passage; + tPtsBought[i] = ptsA; + tPtsBonus[i] = ptsB; i++; - fscanf(fe,"%d%c%c%d%c", &noC, &nom, &prenom, &age, &statut); + fscanf(fe,"%d%c%c%d%d%d%d%d%c", &noC, &nom, &prenom, &age, &carte, &activite, &passage, &ptsA, &ptsB, &categorie); } } fclose(fe); @@ -78,11 +83,27 @@ void fAffichage1Client(int *tNoClient, char *tNomClient, char *tPreClient, int * printf("Le numero client n'a pas été trouvé \n"); printf("Veuillez entrer a nouveau le N° Client ou taper -1 pour annuler\n"); scanf("%d", &NonTrouve); - - } + if(NonTrouve==-1) + return; + else + fRecherche(tNoClient, n, noClient, &coderet, &rang); + trouve=coderet; } - printf(" N° Client\t Nom\t Prénom\t Age\t Tarif\n"); + printf("%d\t %c%*c \t %c%*c\t %d\t %c\n", tNoClient[rang], tNomClient[rang], tPreClient[rang], tAge[rang], tStatut[rang]); } + + +//Affichage plusieurs client avec toutes les données +int afficheTous(int *tNoClient, char *tNomClient, char *tPreClient, int *tAge, char *tStatut, int n, int noClient ) +{ + int i; + printf(" N° Client\t Nom\t Prénom\t Age\t Tarif\n"); + for (int i = 0; i < n; ++i) + { + printf("%d\t %c%*c\t %c%*c\t %d\t %c%*c\n", tNoClient, tNomClient, tPreClient, tAge, tStatut); + } +} + diff --git a/SAE algo/fRox.h b/fRox.h similarity index 56% rename from SAE algo/fRox.h rename to fRox.h index 9f70a21..f1d7385 100644 --- a/SAE algo/fRox.h +++ b/fRox.h @@ -1,6 +1,8 @@ #include #define TAILLE 500 -int fchargement(int *tNoClient, char *tNomClient, char *tPreClient, int *tAge, char *tStatut, int tmax); +int fchargement(int *tNoClient, char *tNomClient, char *tPreClient, int *tAge, int *tCActiv, int *tActivite, int *tPasseouPas,int *tPtsBought, int *tPtsBonus, char *tCat, int tmax); void fRecherche(int *tNoClient, int n, int noClient, int *coderet, int *rang); void fAffichage1Client(int *tNoClient, char *tNomClient, char *tPreClient, int *tAge, char *tStatut, int n, int noClient ); +int afficheTous(int *tNoClient, char *tNomClient, char *tPreClient, int *tAge, char *tStatut, int n, int noClient ) + diff --git a/hCommun.h b/hCommun.h new file mode 100644 index 0000000..d22cc82 --- /dev/null +++ b/hCommun.h @@ -0,0 +1 @@ +hCommun \ No newline at end of file diff --git a/maincommun.c b/maincommun.c new file mode 100644 index 0000000..f517513 --- /dev/null +++ b/maincommun.c @@ -0,0 +1 @@ +//main commun \ No newline at end of file diff --git a/testrox.c b/testrox.c new file mode 100644 index 0000000..13c2926 --- /dev/null +++ b/testrox.c @@ -0,0 +1,13 @@ +#include +#include "fRox.h" + + +void main(void) +{ int *tNoClient, *tAge, toto, *tCActiv, *tActivite, *tPtsBought, *tPtsBonus; + char *tNomClient, *tPreClient, *tCat; + + toto =fchargement(tNoClient, tNomClient, tPreClient, tAge, tCActiv, tActivite, tActivite, tPtsBought, tPtsBonus, tCat, 500); + printf("%d\n", toto); + + +}