Calculadora



Breve Descripción del Programa:

"Este programa es una tipica calculadora estandar que realiza operaciones simples; suma, resta, multiplicación y división.

Dim op As String
Dim num1 As Integer
Dim num2 As Integer

Private Sub cmd0_Click()
screen.Text = screen.Text & "0"
End Sub

Private Sub cmd1_Click()
screen.Text = screen.Text & "1"
End Sub

Private Sub cmd2_Click()
screen.Text = screen.Text & "2"
End Sub

Private Sub cmd3_Click()
screen.Text = screen.Text & "3"
End Sub

Private Sub cmd4_Click()
screen.Text = screen.Text & "4"
End Sub

Private Sub cmd5_Click()
screen.Text = screen.Text & "5"
End Sub

Private Sub cmd6_Click()
screen.Text = screen.Text & "6"
End Sub

Private Sub cmd7_Click()
screen.Text = screen.Text & "7"
End Sub

Private Sub cmd8_Click()
screen.Text = screen.Text & "8"
End Sub

Private Sub cmd9_Click()
screen.Text = screen.Text & "9"
End Sub

Private Sub cmddivision_Click()
num1 = screen.Text
screen.Text = ""
op = "/"
End Sub

Private Sub cmdmulti_Click()
num1 = screen.Text
screen.Text = ""
op = "x"
End Sub

Private Sub cmdresta_Click()
num1 = screen.Text
screen.Text = ""
op = "-"
End Sub

Private Sub cmdresultado_Click()
num2 = screen.Text
If op = "+" Then
screen.Text = num1 + num2
ElseIf op = "-" Then
screen.Text = num1 - num2
ElseIf op = "-" Then
screen.Text = num1 - num2
ElseIf op = "x" Then
screen.Text = num1 * num2
ElseIf op = "/" Then
screen.Text = num1 / num2
End If

End Sub

Private Sub cmdsuma_Click()
num1 = screen.Text
screen.Text = ""
op = "+"
End Sub

Private Sub limpia_Click()
screen.Text = ""
End Sub

0 Tu opinion =D: