Simplification de l'Ajout de client

doc
Rémi LAVERGNE 1 year ago
parent a459857202
commit 24f629909f
No known key found for this signature in database
GPG Key ID: 8861D8A4AD21A032

@ -9,11 +9,8 @@
* @param tlog: Taille logique de ces tableaux * @param tlog: Taille logique de ces tableaux
* @return 0 > Tout s'est bien passé, -1 > L'utilisateur a quitté, -2 > La taille physique du tableau est dépassée * @return 0 > Tout s'est bien passé, -1 > L'utilisateur a quitté, -2 > La taille physique du tableau est dépassée
*/ */
int inputClient(int clientID[], float cagnotte[], int suspended[], int isAdmin[], int *tlog) int inputClient(int id, int passwd, int index, int clientID[], int clientPassword[], float cagnotte[], int suspended[], int isAdmin[], int *tlog)
{ {
int index, found, id = -1;
float cagnotteClient;
// Vérification du dépassement de la taille physique du tableau // Vérification du dépassement de la taille physique du tableau
if (*tlog == tmaxClients) if (*tlog == tmaxClients)
{ {
@ -21,34 +18,21 @@ int inputClient(int clientID[], float cagnotte[], int suspended[], int isAdmin[]
return -2; return -2;
} }
while(id != 0) // Décalage
{ decalageADroite(clientID, index, *tlog);
printf("Entrez l'identifiant du client ou 0 si vous souhaitez arrêter la saisie: "); decalageADroite(cagnotte, index, *tlog);
scanf("%d%*c", &id); decalageADroite(suspended, index, *tlog);
while(id < 0) decalageADroite(isAdmin, index, *tlog);
{
printf("[ERREUR] - L'identifiant doit être positif, entrez l'identifiant du client ou 0 si vous souhaitez arrêter la saisie: ");
scanf("%d%*c", &id);
}
index = searchTab(clientID, id, *tlog, &found);
while(found == 1)
{
printf("Cet identifiant existe déjà, réessayer ou tapez 0 si vous souhaitez arrêter la saisie: ");
scanf("%d%*c", &id);
index = searchTab(clientID, id, *tlog, &found);
}
if(id != 0)
{
clientID[index] = id; clientID[index] = id;
clientPassword[index] = encrypt(passwd);
cagnotte[index] = 0; cagnotte[index] = 0;
suspended[index] = 0; suspended[index] = 0;
isAdmin[index] = 0; isAdmin[index] = 0;
*tlog++; *tlog++;
return 0; // Tout s'est bien passé return 0; // Tout s'est bien passé
} }
}
return -1; // L'utilisateur a quitté
}
void modifyClient(int clientID[], float cagnotte[], int suspended[], int isAdmin[], int tlog) void modifyClient(int clientID[], float cagnotte[], int suspended[], int isAdmin[], int tlog)
{ {

Loading…
Cancel
Save