Ho un array di questo tipo:
devo filtrarlo ed ottenere questo:codice:10 8 7 7 5 5 3 2
in pratica evitare che ci siano valori che si ripetono.codice:10 8 7 5 3 2
esiste una funzione ho devo ciclare i valori?
Grazie
Ho un array di questo tipo:
devo filtrarlo ed ottenere questo:codice:10 8 7 7 5 5 3 2
in pratica evitare che ci siano valori che si ripetono.codice:10 8 7 5 3 2
esiste una funzione ho devo ciclare i valori?
Grazie
Hey hey, my my Rock and roll can never die!
Dim mat(8), matris(8)
mat(1) = 10 '10 8 7 7 5 5 3 2
mat(2) = 8
mat(3) = 7
mat(4) = 7
mat(5) = 5
mat(6) = 5
mat(7) = 3
mat(8) = 2
For i = 1 To 8
For k = i + 1 To 8
If mat(i) = mat(k) Then mat(k) = -1
Next k
Next i
n = 0
For i = 1 To 8
If mat(i) < 0 Then
Else
n = n + 1
matris(n) = mat(i)
End If
Next i
'controlla
For i = 1 To n
If matris(i) = matris(i) Then Stop
Next i