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