懂VB的进来,这个是个计算器的代码,但是计算的时候,0.8除以2就是0.5.0.2除以2就是0.等于说是四舍五入Dim IntNum As IntegerDim LonNum As LongDim IntNum2 As IntegerPrivate Sub Command1_Click()If IntNum2 = 1 ThenText1.Text =

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/30 11:54:49
懂VB的进来,这个是个计算器的代码,但是计算的时候,0.8除以2就是0.5.0.2除以2就是0.等于说是四舍五入Dim IntNum As IntegerDim LonNum As LongDim IntNum2 As IntegerPrivate Sub Command1_Click()If IntNum2 = 1 ThenText1.Text =
x[OAǿfm˲ mj|m#hBR6XbZDE_fgwx+,r&}̜9gs~mua̯/[÷iD)°zs~ `RWh> dDtv^]@O`( +3f#ђa|U,#U7z:10#3#@4 (ηл]Ó>ɌQyn_7>/c4Aeub}Dԥlq? F_[8L0Ó&dzhzH(*K K 'Y>F}HH"rR ȄDj!7D-|?̓zcO?~(UsBul^Ƃ\ ws^oŢzXN!ScK46s4՞i;-f(Z$*\WRaYFg]aM~c+ u&

懂VB的进来,这个是个计算器的代码,但是计算的时候,0.8除以2就是0.5.0.2除以2就是0.等于说是四舍五入Dim IntNum As IntegerDim LonNum As LongDim IntNum2 As IntegerPrivate Sub Command1_Click()If IntNum2 = 1 ThenText1.Text =
懂VB的进来,这个是个计算器的代码,但是计算的时候,0.8除以2就是0.5.0.2除以2就是0.等于说是四舍五入
Dim IntNum As Integer
Dim LonNum As Long
Dim IntNum2 As Integer
Private Sub Command1_Click()
If IntNum2 = 1 Then
Text1.Text = 1
IntNum2 = 0
Else
Text1.Text = Text1.Text & 1
End If
End Sub
Private Sub Command10_Click()
If IntNum2 = 1 Then
Text1.Text = 6
IntNum2 = 0
Else
Text1.Text = Text1.Text & 6
End If
End Sub
Private Sub Command11_Click()
If IntNum2 = 1 Then
Text1.Text = 9
IntNum2 = 0
Else
Text1.Text = Text1.Text & 9
End If
End Sub
Private Sub Command12_Click()
LonNum = Text1.Text
IntNum = 4
Text1.Text = ""
End Sub
Private Sub Command13_Click()
LonNum = Text1.Text
IntNum = 1
Text1.Text = ""
End Sub
Private Sub Command14_Click()
LonNum = Text1.Text
IntNum = 2
Text1.Text = ""
End Sub
Private Sub Command15_Click()
LonNum = Text1.Text
IntNum = 3
Text1.Text = ""
End Sub
Private Sub Command16_Click()
If IntNum = 1 Then
Text1.Text = LonNum + Text1.Text
ElseIf IntNum = 2 Then
Text1.Text = LonNum - Text1.Text
ElseIf IntNum = 3 Then
Text1.Text = LonNum * Text1.Text
ElseIf IntNum = 4 Then
If Text1.Text = 0 Then
Ret = MsgBox("除数不能为0",32 + 3,"错误")
Else
Text1.Text = LonNum / Text1.Text
End If
End If
IntNum2 = 1
End Sub
Private Sub Command17_Click()
Text1.Text = ""
End Sub
Private Sub Command2_Click()
If IntNum2 = 1 Then
Text1.Text = 4
IntNum2 = 0
Else
Text1.Text = Text1.Text & 4
End If
End Sub
Private Sub Command3_Click()
If IntNum2 = 1 Then
Text1.Text = 7
IntNum2 = 0
Else
Text1.Text = Text1.Text & 7
End If
End Sub
Private Sub Command4_Click()
If IntNum2 = 1 Then
Text1.Text = "."
IntNum2 = 0
Else
Text1.Text = Text1.Text & "."
End If
End Sub
Private Sub Command5_Click()
If IntNum2 = 1 Then
Text1.Text = 2
IntNum2 = 0
Else
Text1.Text = Text1.Text & 2
End If
End Sub
Private Sub Command6_Click()
If IntNum2 = 1 Then
Text1.Text = 5
IntNum2 = 0
Else
Text1.Text = Text1.Text & 5
End If
End Sub
Private Sub Command7_Click()
If IntNum2 = 1 Then
Text1.Text = 8
IntNum2 = 0
Else
Text1.Text = Text1.Text & 8
End If
End Sub
Private Sub Command8_Click()
If IntNum2 = 1 Then
Text1.Text = 0
IntNum2 = 0
Else
Text1.Text = Text1.Text & 0
End If
End Sub
Private Sub Command9_Click()
If IntNum2 = 1 Then
Text1.Text = 3
IntNum2 = 0
Else
Text1.Text = Text1.Text & 3
End If
End Sub

懂VB的进来,这个是个计算器的代码,但是计算的时候,0.8除以2就是0.5.0.2除以2就是0.等于说是四舍五入Dim IntNum As IntegerDim LonNum As LongDim IntNum2 As IntegerPrivate Sub Command1_Click()If IntNum2 = 1 ThenText1.Text =
由于你声明的变量都是整数,所以VB在赋值时会先进行取整,比如在Text1输入0.8,则
LonNum = Text1.Text = 0.8 转为整数就是1
再把1除以2不就是0.5吗?
同理,输入0.2则VB会自动转为0,然后0除以2不就是0吗?
应该把变量声明为浮点数(Single或Double)

懂VB的进来,这个是个计算器的代码,但是计算的时候,0.8除以2就是0.5.0.2除以2就是0.等于说是四舍五入Dim IntNum As IntegerDim LonNum As LongDim IntNum2 As IntegerPrivate Sub Command1_Click()If IntNum2 = 1 ThenText1.Text = 求有数字按键的简单vb计算器代码,插入到哪才能用呢 如何使用VB做个加减乘除的小计算器 如何使用VB做个加减乘除的小计算器 VB里如何做个可以计算sin和cos的计算器? 求代码在文本框中输入一个弧度 可以在标签里显示出sin的值 不知道代码怎么编 VB随机产生10个10到100的整数,每行输出10个代码怎么写?必须是基数 VB怎么画连续正弦波时每一个正弦波的波峰不同,求VB代码现在的这个是波峰相同 ,要求波峰不同 有高有低就像这样 求个可以将一个句子中的中文和英文分开并分行显示的VB代码我需要做些英语词库,但是这个词库必须要求里面的文档结构是这样的,第一行是英文(可以是一个单词或几个单词组成的短语), VB随机产生3位数的代码 vf计算器按钮加减乘除的代码 怎么做VB语言的计算器啊 vb 计算器中按等号再按数字键时的问题我用vb编写了一个计算器程序,数字输入的代码是这样的Text1.Text = Text1.Text & 7,可在按下=号键后,希望再按数字键时是重新输入,而不是在后面添加,如何编 在VB中计算器的代码(要求0到9的加减乘除运算)只要0到9的加减乘除还有等于号其他都不需要 vb编计算器中连续运算的代码,以及按等号后得出的数如何继续运算?编得好的加分 用C#编个计算器,那个0键和小数点的代码要怎么写? 易语言程序计算器数字按钮代码怎么写我是易语言的初学者,我想做个简单的计算器.加、减、乘、除、的代码我已经摸索出来了,但数字键的代码不懂, VB中,log(X)如何计算,代码是什么,其中X是大于0的自然数 用VB做计算机,退位键的语句是什么不是语句是代码