You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
1.6 KiB
73 lines
1.6 KiB
#include <stdio.h>
|
|
#include "fRox.h"
|
|
|
|
|
|
|
|
|
|
|
|
//Fonction recherche, (*coderet = 1 si trouvé, = 0 si pas trouvé.) (*rang = rang a laquel se trouve ou doit se trouver la valeur)
|
|
void fRecherche(int *tNoClient, int n, int noClient, int *coderet, int *rang)
|
|
{
|
|
int i;
|
|
|
|
for(i = 0; i < n; i++)
|
|
{
|
|
if(tNoClient[i] == noClient)
|
|
{
|
|
*coderet = 1;
|
|
*rang = i;
|
|
return;
|
|
}
|
|
if(tNoClient[i] > noClient)
|
|
|
|
*rang = i;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
//Affichage D'UN client avec toutes ses données.
|
|
void fAffichage1Client(int *tNoClient, char *tNomClient, char *tPreClient, int *tAge, char *tStatut, int n, int noClient )
|
|
{
|
|
int i, coderet, rang, trouve, NonTrouve;
|
|
|
|
|
|
fRecherche(tNoClient, n, noClient, &coderet, &rang);
|
|
|
|
trouve = coderet;
|
|
|
|
while (trouve == 0)
|
|
{
|
|
if(coderet == 0)
|
|
{
|
|
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);
|
|
}
|
|
}
|
|
|
|
int nbmEntree()
|
|
{
|
|
|
|
} |