Ejemplo de Examen Final de Programación I en Visual Basic
Ejemplo de Examen Final de Programación I en Visual Basic
Consigna:
Cargar valores múltiplos de 5: del 5 al 50
números >9 y <20 Mayor Parcial
números >20 y <35 Menor Parcial
números >45 y <50 Promedio Parcial
mayor (>) valor general
menor (<) valor general
Promedio General
Código Fuente:
Dim c9, c20, c35, con, i As Integer
Dim t9, t20, t35, acu As Currency
Private Type charly
num As Integer
End Type
Dim matrix(10) As charly
Private Sub Cargar_Click()
For i = 0 To 10
......matrix(i).num = Text1
Next i
If Text1 >= 9 And Text1 <= 20 Then
......c9 = c9 + 1
......t9 = t9 + Text1
......Text2 = t9 / c9
End If
If Text1 >= 20 And Text1 <= 35 Then
......c20 = c20 + 1
......t20 = t20 + Text1
......Text3 = t20 / c20
End If
If Text1 >= 45 And Text1 <= 50 Then
......c35 = c35 + 1
......t35 = t35 + Text1
......Text4 = t35 / c35
End If
If Text1 = 5 Then
......Text6 = Text1
End If
If Text1 = 50 Then
......Text5 = Text1
End If
If Text1 > 0 Then
......con = con + 1
......acu = acu + Text1
......Text7 = acu / con
End If
End Sub
Private Sub Limpiar_Load()
c9 = 0
c20 = 0
c35 = 0
t9 = 0
t20 = 0
t35 = 0
Text1 = 0
Text2 = 0
Text3 = 0
Text4 = 0
Text5 = 0
Text6 = 0
Text7 = 0
End Sub
Private Sub Salir_Click()
Unload Me
End Sub