voici le tableau des notes et des coefficients (note et coeff):
12 2
11 1
19 2
8 4
14 1
le but serai de faire d'abord une moyenne par coefficient puis on calculerai la moyenne final.
en fait, on aurai:
(((12+19)/2)*2+((11+14)/2)*1+8*4)/(2+1+4)
pour faire cela, j'ai rangé les notes par coefficients
11 1
14 1
12 2
19 2
8 4
ensuite j'ai essayé de faire le calcul de la moyenne mais il me met l'erreur imcompatibilité de type.
voici le code pour ranger les notes suivant le coefficient, ce code a l'air de marché.
If txt_note <> "" Then
tmoy(ar).note = CInt(txt_note.Text)
tmoy(ar).coef = CInt(txt_coeff.Text)
ar = ar + 1
End If
num = ar
z = 0
Do While z <> num
k = z + 1
l = z + 1
Do While k <> num + 1
k = k + 1
If tmoy(k).coef < tmoy(l).coef Then
l = k
End If
Loop
var = tmoy(z + 1).coef
tmoy(z + 1).coef = tmoy(l).coef
tmoy(l).coef = var
varn = tmoy(z + 1).note
tmoy(z + 1).note = tmoy(l).note
tmoy(l).note = varn
z = z + 1
Loop
voici le code qui me permet de calculer la moyenne mais il y a un problème
'essai petite moyenne
Do While tmoy(p).coef <> ""
search = tmoy(p).coef
Do While tmoy(p).coef = search
no = no + tmoy(p).note
nb = nb + 1
p = p + 1
Loop
mo = no / nb
tmoyg(m).moyenne = mo
tmoyg(m).nb = nb
m = m + 1
Loop
For m = 1 To p
nos = tmoyg(m).moyenne
nomb = tmoyg(m).nb
moyterm = moyterm + (nos * nomb)
moynomb = moynomb + nomb
Next
moyfinal = moyterm / moynomb
txt_dagl.Text = moyfinal
si quelqu'un aurai une solution à mon problème ou si quelqu'un voit une autre solution, j'aimerai qu'il me fasse parvenir ces solutions.
je vous remercie d'avance
coordialement
adrien