forked from menault/2026_TD3_DEV51_Qualite_Algo
fixes F2
This commit is contained in:
@@ -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)
|
|
||||||
nb++;
|
|
||||||
}
|
}
|
||||||
return nb;
|
free(deja_vu);
|
||||||
|
return nbr_clients;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* F3 : solde total de chaque client */
|
/* F3 : solde total de chaque client */
|
||||||
|
|||||||
Reference in New Issue
Block a user