forked from menault/2026_TD3_DEV51_Qualite_Algo
F9 : M réduit de 14 à 8
This commit is contained in:
@@ -183,32 +183,29 @@ long nb_facons_rendre(int somme, int nb_pieces)
|
||||
/* F9 : catégorie d'une transaction (pour les statistiques) */
|
||||
int categorie(const Transaction *t)
|
||||
{
|
||||
bool weekend = t->jour % 7 >= 5;
|
||||
bool debut_mois = t->jour % 30 == 0;
|
||||
bool client_rond = t->client % 10 == 0;
|
||||
|
||||
if (t->montant == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (t->montant < 0) {
|
||||
if (t->montant < -20000) {
|
||||
if (t->jour % 7 == 5 || t->jour % 7 == 6)
|
||||
return 1;
|
||||
else
|
||||
return 2;
|
||||
return 2-weekend;
|
||||
} else if (t->montant < -5000) {
|
||||
return 3;
|
||||
} else {
|
||||
if (t->client % 10 == 0)
|
||||
return 4;
|
||||
return 5;
|
||||
return 5 - client_rond;
|
||||
}
|
||||
} else if (t->montant == 0) {
|
||||
return 0;
|
||||
} else {
|
||||
if (t->montant > 30000) {
|
||||
if (t->client % 10 == 0 && t->jour % 7 < 5)
|
||||
return 6;
|
||||
return 7;
|
||||
return 7 - (client_rond && !weekend);
|
||||
} else if (t->montant > 10000) {
|
||||
return 8;
|
||||
} else if (t->montant > 1000) {
|
||||
if (t->jour % 30 == 0)
|
||||
return 9;
|
||||
return 10;
|
||||
return 10 - debut_mois;
|
||||
}
|
||||
return 11;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user