用VB6.0做一个简易的小程序。当作业,要算分数的。跪求高手
3个回答
2012-12-13
展开全部
Public x As Boolean
Public oper As Integer
Public z As String
Public result As String
Private Sub Command1_Click(Index As Integer)
If x Then
Text1.Text = ""
x = False
Text1.Text = Text1.Text + CStr(Index + 1)
Else
Text1.Text = Text1.Text + CStr(Index + 1)
End If
End Sub
Private Sub Command2_Click()
x = True
oper = Int(Text1.Text)
z = "/"
End Sub
Private Sub Command3_Click()
x = True
oper = Int(Text1.Text)
z = "-"
End Sub
Private Sub Command4_Click()
x = True
oper = Int(Text1.Text)
z = "+"
End Sub
Private Sub Command5_Click()
x = True
oper = Int(Text1.Text)
z = "*"
End Sub
Private Sub Command7_Click()
Select Case z
Case "/"
result = CStr(oper / Int(Text1.Text))
Case "-"
result = CStr(oper - Int(Text1.Text))
Case "*"
result = CStr(oper * Int(Text1.Text))
Case "+"
result = CStr(oper + Int(Text1.Text))
End Select
Text1.Text = result
End Sub
Private Sub Command8_Click()
Text1.Text = ""
End Sub
简单的计算器程序自己添加控件
Public oper As Integer
Public z As String
Public result As String
Private Sub Command1_Click(Index As Integer)
If x Then
Text1.Text = ""
x = False
Text1.Text = Text1.Text + CStr(Index + 1)
Else
Text1.Text = Text1.Text + CStr(Index + 1)
End If
End Sub
Private Sub Command2_Click()
x = True
oper = Int(Text1.Text)
z = "/"
End Sub
Private Sub Command3_Click()
x = True
oper = Int(Text1.Text)
z = "-"
End Sub
Private Sub Command4_Click()
x = True
oper = Int(Text1.Text)
z = "+"
End Sub
Private Sub Command5_Click()
x = True
oper = Int(Text1.Text)
z = "*"
End Sub
Private Sub Command7_Click()
Select Case z
Case "/"
result = CStr(oper / Int(Text1.Text))
Case "-"
result = CStr(oper - Int(Text1.Text))
Case "*"
result = CStr(oper * Int(Text1.Text))
Case "+"
result = CStr(oper + Int(Text1.Text))
End Select
Text1.Text = result
End Sub
Private Sub Command8_Click()
Text1.Text = ""
End Sub
简单的计算器程序自己添加控件
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
跪着吧,这样的学生,不学无术也就罢了,连基本的常识都没有,“要算分数的”------算什么分,如何个算法?先学会语言表达再说吧。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2012-12-14
展开全部
msgbox "小程序"
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询