This commit is contained in:
2026-10-21 11:08:30 +02:00
parent 5f05c1abfe
commit 914e03b290
+10 -11
View File
@@ -88,19 +88,18 @@ void trier_par_montant(Transaction *t, int n)
/* F2 : nombre de clients ayant au moins une transaction */ /* F2 : nombre de clients ayant au moins une transaction */
int nb_clients_distincts(const Transaction *t, int n) int nb_clients_distincts(const Transaction *t, int n)
{ {
int nb = 0; int nbr_clients = 0;
for (int i = 0; i < n; i++) { int *deja_vu = (int*) calloc(NB_CLIENTS,sizeof(int));
int deja_vu = 0;
for (int j = 0; j < i; j++) { for (int i = 0 ; i < n ; i++){
if (t[j].client == t[i].client) { if (deja_vu[t[i].client] == 0){
deja_vu = 1; deja_vu[t[i].client] = 1;
break; nbr_clients +=1;
} }
} }
if (!deja_vu) free(deja_vu);
nb++; return nbr_clients;
}
return nb;
} }
/* F3 : solde total de chaque client */ /* F3 : solde total de chaque client */