forked from menault/2026_TD3_DEV51_Qualite_Algo
Merge branch 'main' into main
This commit is contained in:
@@ -88,18 +88,17 @@ 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 clients_vus[NB_CLIENTS] = {0};
|
||||
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)
|
||||
int client = t[i].client;
|
||||
if (!clients_vus[client]) {
|
||||
clients_vus[client] = 1;
|
||||
nb++;
|
||||
}
|
||||
}
|
||||
|
||||
return nb;
|
||||
}
|
||||
|
||||
@@ -119,10 +118,10 @@ void total_par_jour(const Transaction *t, int n, long *totaux)
|
||||
{
|
||||
for (int j = 0; j < NB_JOURS; j++) {
|
||||
totaux[j] = 0;
|
||||
for (int i = 0; i < n; i++)
|
||||
if (t[i].jour == j)
|
||||
totaux[j] += t[i].montant;
|
||||
}
|
||||
|
||||
for (int i = 0; i < n; i++)
|
||||
totaux[t[i].jour] += t[i].montant;
|
||||
}
|
||||
|
||||
/* F5 : période de jours consécutifs dont la somme des soldes est maximale */
|
||||
|
||||
Reference in New Issue
Block a user