diff --git a/SAE algo/test b/SAE algo/test deleted file mode 100755 index ce5d9b1..0000000 Binary files a/SAE algo/test and /dev/null differ 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); + + +}