terça-feira, 30 de novembro de 2010

ficha numero 14 exercicio 3

Private Sub Command1_Click()
Dim x As Integer, y As Integer, mat(1 To 5, 1 To 3) As Integer, cont1 As Integer, cont2 As Integer, cont3 As Integer

Randomize

For x = 1 To 5
For y = 1 To 3
Do
mat(x, y) = Val(InputBox("Introduza a " & y & "º nota do aluno " & x))
Loop Until mat(x, y) >= 0 And mat(x, y) <= 20
Picture1.Print mat(x, y);
Next y
Picture1.Print Chr(13)
Next x
cont1 = 0
cont2 = 0
cont3 = 0
For x = 1 To 5
If mat(x, 1) < 10 Then
cont1 = cont1 + 1
End If
       
If mat(x, 2) >= 10 Then
cont2 = cont2 + 1
End If
If mat(x, 3) > 16 Then
cont3 = cont3 + 1
End If
Next x

MsgBox "Negativas na prova 1: " & cont1 & "  Positivas na prova 2: " & cont2 & "   Notas maior que 16: " & cont3, vbOKOnly + vbInformation, "Resultado"

End Sub

Private Sub Command2_Click()
If MsgBox("Quer mesmo sair?", vbOKCancel + vbQuestion, "ATENÇÃO") Then
End
End If
End Sub



Sem comentários:

Enviar um comentário