求用vb编写一个简易计算器的程序代码

 我来答
nqgfa65
2010-12-24 · TA获得超过225个赞
知道答主
回答量:281
采纳率:0%
帮助的人:181万
展开全部
Private Sub Command1_Click()
Text3.Text = Val(Text1.Text) + Val(Text2.Text)
Label1.Caption = "+"
End Sub

Private Sub Command2_Click()
Text3.Text = Val(Text1.Text) - Val(Text2.Text)
Label1.Caption = "-"
End Sub

Private Sub Command3_Click()
Text3.Text = Val(Text1.Text) * Val(Text2.Text)
Label1.Caption = "*"
End Sub

Private Sub Command4_Click()
Text3.Text = Val(Text1.Text) \ Val(Text2.Text)
Label1.Caption = "\"
End Sub

Private Sub Command5_Click()
Text1.Text = 0
Text2.Text = 0
Text3.Text = 0
End Sub
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
Jessi林
2010-12-23
知道答主
回答量:19
采纳率:0%
帮助的人:0
展开全部
界面:
text1
1 2 3 +
4 5 6 -
7 8 9 *
0 = AC /
代码:
dim newnum as boolean
dim n1,n2 op as integer
private sub ac_click()
text1.text=""
end sub
private sub command1_click(index as integer)
if newnum=true then text1=""
text1=text1&index
newnum=false
end sub
private sub command1_click(index as integer)
if op=0 then
n1=val(text1)
else
n2=val(text1)
select case op
case 1
text1=n1+n2
case 2
text1=n1-n2
case 3
text1=n1*n2
case 4
if n2<>0 then text1=n1/n2
end select
op=0
end if
if index>0 then op=index
n1=val(text1)
newnum=true
end sub
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
李洛之奇
2010-12-23 · 超过16用户采纳过TA的回答
知道答主
回答量:67
采纳率:0%
帮助的人:42.1万
展开全部
c的要不要
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 1条折叠回答
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式