void main ()
{
int ch_[20], Flagch_[20];
int tTemp = 0, tMin = 0, tMax = 0, tTot = 0;
float tMoy;
// Variables drapeau
int tFlag = 0;
// Variables d'incrémentation
int tNbr = 0, i = 0, o = 0, nOcc;
do
{
printf("\nEntrez un nombre positif: ");
scanf("%d",&tTemp);
if (tTemp < 0) { printf("Le nombre entré n'est pas positif !\n"); } // Pour une version compatible QUE Win32 avec la lib foireuse conio.h
else if (tTemp > 100) { ch_[tNbr] = tTemp; Flagch_[i] = 0; tNbr++; tFlag = 1; } // Il faut ecrire textcolor(RED); cprintf("Cay beau le rouge <3");
else { ch_[tNbr] = tTemp; Flagch_[i] = 0; tNbr++; }
} while (tFlag == 0 && tNbr<20); //tFlag == 0 quand le nombre entré > 100 et tNbr = 19 max car [0->19]
printf("\nIl y a %d nombres enregistrés !",tNbr);
// Calcul de la moyene
/// Minimum?
i = 0;
tMin = ch_[0]; // Initialisation de la variable pour différencier le premier.
while (i < tNbr)
{
if (tMin > ch_[i]) tMin = ch_[i];
i++;
}
/// Maximum?
i = 0;
while (i < tNbr)
{
tTot = tTot + ch_[i]; // <-- Ca va servir pour la moyenne
if (tMax < ch_[i]) tMax = ch_[i];
i++;
}
// Le tableau super dur !
i = 0;
printf("\nN O\n");
while (i < tNbr) {
if (Flagch_[i] == 0)
{
nOcc = 0;
o = 0;
while (o < tNbr)
{
if (ch_[o] == ch_[i]) { Flagch_[o] = 1; nOcc++; }
o++;
}
printf("%d %d\n",ch_[i],nOcc );
}
i++;
}
// Calcul de la moyenne
tMoy = tTot-tMax-tMin;
i = tNbr-2;
tMoy = tMoy/i;
printf("Le minimum est : %d, le maximum est %d et la moyenne est: %f\n",tMin,tMax,tMoy);
}
