Skip to content

Commit

Permalink
vse!
Browse files Browse the repository at this point in the history
  • Loading branch information
ananas7 committed Mar 22, 2014
1 parent 830094c commit a0cb686
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 35 deletions.
126 changes: 92 additions & 34 deletions Calc.frm
Original file line number Diff line number Diff line change
Expand Up @@ -378,15 +378,21 @@ Dim s As String
Dim press As Boolean
Dim buf1 As String
Dim buf As Double
Dim sum As Boolean
Dim change1 As Boolean
Dim equal1 As Boolean
Dim die As Boolean
Dim press1 As Boolean
Dim number1 As Boolean
Dim delete1 As Boolean

Dim equal2 As Boolean
Dim first As Boolean

Private Sub change_Click(Index As Integer)
If Not die Then
If Not number1 Then
text1.Text = 0
Else
buf1 = text1.Text
buf = -CDbl(buf1)
point2 = Right(buf1, 1)
Expand All @@ -395,22 +401,24 @@ Private Sub change_Click(Index As Integer)
Else
text1.Text = buf
End If
number1 = True
If equal1 Then
a = text1.Text
s = ""
a = text1.Text
change1 = True
End If
End If
End Sub

Private Sub delete2_Click(Index As Integer)
text1.Text = "0"
s = ""
change1 = False
die = False
press = False
equal1 = False
equal2 = False
number1 = False
delete1 = True
first = False
sum = False
a = 0
b = 0
End Sub
Expand Down Expand Up @@ -438,9 +446,8 @@ Private Sub Form_KeyPress(KeyAscii As Integer)
KeyAscii = 0
End Sub


Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
Debug.Print KeyCode
text1.SetFocus
If KeyCode = 46 Then
delete2_Click (0)
ElseIf KeyCode = 120 Then
Expand All @@ -449,14 +456,16 @@ Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
KeyCode = 0
End Sub



Private Sub number_Click(Index As Integer)
If Not die Then
If press And Not number1 Then
text1.Text = "0"
text1.Text = ""
press = False
End If
If change1 And equal1 Then
text1.Text = ""
chang1 = False
End If
If text1.Text = "0" Then
text1.Text = ""
End If
Expand All @@ -465,6 +474,10 @@ Private Sub number_Click(Index As Integer)
text1.Text = text1.Text & number(Index).Caption
End If
number1 = True
If equal1 Then
first = False
sum = False
End If
End If
End Sub

Expand All @@ -482,6 +495,10 @@ Private Sub point_Click(Index As Integer)
text1.Text = text1.Text & ","
number1 = True
End If
If equal1 Then
first = False
sum = False
End If
End Sub

Private Sub sign_Click(Index As Integer)
Expand All @@ -490,67 +507,108 @@ Private Sub sign_Click(Index As Integer)
a = text1.Text
ElseIf Not equal1 And number1 Then
b = text1.Text
first = True
End If
If Index = 17 Then
If press And Not number1 And Not equal1 Then
b = a
End If
equal1 = True
sum = True
equal2 = False
first = False
End If
If number1 Or equal1 Then
If Not equal1 And (number1 Or sum) Then
If s = "+" Then
text1.Text = a + b
a = text1.Text
ElseIf s = "-" Then
text1.Text = a - b
a = text1.Text
ElseIf s = "*" Then
text1.Text = a * b
a = text1.Text
ElseIf s = "/" Then
If b <> 0 Then
text1.Text = a / b
Else
text1.Text = "YOU DIE BUSTERD!!!"
If b = 0 Then
text1.Text = "You DIE busterd!"
die = True
Else
text1.Text = a / b
a = text1.Text
End If
End If
If Not die Then
a = text1.Text
End If
number1 = False
equal2 = True
End If
press = True
If Index = 10 Then
s = "+"
If Not first Then
b = 0
End If
If equal1 Then
equal1 = False
a = text1.Text
b = 0
equal1 = False
End If
ElseIf Index = 11 Then
s = "-"
If Not first Then
b = 0
End If
If equal1 Then
equal1 = False
a = text1.Text
b = 0
a = text1.Text
equal1 = False
End If
ElseIf Index = 12 Then
If Not first Then
b = 1
End If
s = "*"
If equal1 Then
equal1 = False
If equal1 And (number1 Or sum) Then
a = text1.Text
b = 1
equal1 = False
End If
If delete1 Then
ElseIf Index = 13 Then
If Not first Then
b = 1
delete1 = False
End If
ElseIf Index = 13 Then
s = "/"
If equal1 Then
equal1 = False
a = text1.Text
b = 1
equal1 = False
End If
If delete1 Then
End If

If delete1 Then
delete1 = False
If s = "*" Or s = "/" Then
b = 1
delete1 = False
End If
ElseIf Index = 17 Then
equal1 = True
End If
If Not equal2 Then
If s = "+" Then
text1.Text = a + b
a = text1.Text
ElseIf s = "-" Then
text1.Text = a - b
a = text1.Text
ElseIf s = "*" Then
text1.Text = a * b
a = text1.Text
ElseIf s = "/" Then
If b = 0 Then
text1.Text = "You DIE busterd!"
die = True
Else
text1.Text = a / b
a = text1.Text
End If
End If
End If
press = True
number1 = False
End If
End Sub
End Sub

2 changes: 1 addition & 1 deletion Project1.vbw
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Calc = 65, 9, 1011, 462, C, 22, 29, 1007, 439, C
Calc = 65, 9, 1010, 462, , 22, 29, 1007, 439, C

0 comments on commit a0cb686

Please sign in to comment.