martes, 17 de junio de 2014

TABLA DE MULTIPLICAR DE VISUAL BASIC

TABLA DE MULTIPLICAR


Public Class Form1
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim a, b, x, y, c, d As Integer
        Dim w As String
        a = Val(InputBox("inque en que tabla de multiplicar desea evaluarse", "TABLA", 0))
        If a <> 0 Then
            For x = 1 To 10
                b = a * x
                w = "deme el valor de la operacion de " & a & "por" & x
                y = Val(InputBox(w, "examen", 0))
                If y <> 0 Then
                    If y = b Then
                        MsgBox("usted ha acertado", MsgBoxStyle.Information + MsgBoxStyle.Critical, "bien hecho")
                        c = c + 1
                    Else
                        MsgBox("usted se ha equivocado", MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, "mejor para la proxima")
                        d = d + 1
                    End If
                    TextBox1.Text = TextBox1.Text & a & "x" & a & "=" & b & vbCrLf
                Else
                    MsgBox("usted cancelo el proceso", MsgBoxStyle.OkOnly + MsgBoxStyle.Information, "cancelar")
                    End
                End If
            Next
            Label2.text = "el numero total de aciertos es" & c
            Label3.Text = "el numero total de fallas es " & d
        Else
            MsgBox("usted cancelo el proceso", MsgBoxStyle.OkOnly + MsgBoxStyle.Information, "cancelar")
            End
        End If

    End Sub
End Class











No hay comentarios:

Publicar un comentario