文档介绍:实用标准文案
: .
VB计算器
此计算器能够实现加减乘除等一系列的功能。还有实现显示系统时间的附加功能。
程序设计:0-9和点在command1的组内。其他的按钮式运算符和其他功能。
正切和余切有对特殊值进行警告, 除也有对除数为零的情况提示警告, 还有阶乘等一系列计
算溢出的情况提出警告,还有很多需要完善。 。。这仅供参考。
Public sum As Double
Public k As Stri ng
Public dia n As Boolea n
Public b As In teger
Public poin tflag As Boolea n
Dim clearFlag As Boolea n
Public F As Long
'Dim start As boole n
Public resl As Boolean ' 运算结果存储在 resl里
Public ff As Double 'resl 里是否为空
数字按钮在一个组内,点
'llllllllllllllllllllllllllllllllllllllllllllllllllllllll
击按钮输入数字 lllllllllllllllllllllllllllllllllllllllllll
Private Sub comma nd1_click(l ndex As In teger)
Select Case In dex
Case 1
If Not clearFlag The n ' 不是等号,那么显示 1
= & 1
Else ' 是等号,那么清空
= 1
clearFlag = False
End If
If Len() = 2 And InStr(1, Text1, "0") = 1 Then Text1 = Right(Text1, 1)
'如果第一位的数位 0,字符串的长度为 ,即两个数中右面的数
Case 2
If Not clearFlag Then
= & 2
Else
= 2
clearFlag = False
End If
If Len () = 2 And In Str(1, Text1, "0") = 1 The n Text1 : Case 3
If Not clearFlag The n
= & 3
Else
=Right(Text1, 1)
clearFlag = End If
=3
False
If Len () = 2 And In Str(1, Text1, "0") = 1 The n Text1 :
=Right(Text1, 1)
Case 4
If Not clearFlag The n
= & 4
Else
=4
clearFlag =
False
End If
If Len () = 2 And In Str(1, Text1, "0") = 1 The n Text1 :
=Right(Text1, 1)
Case 5
If Not clearFlag Then
= & 5
Else
= 5
clearFlag = False
End If
If Len() = 2 And InStr(1, Text1, "0")=
=1 The n Text1 =
=Right(Text1, 1)
Case 6
If Not clearFlag The n
= & 6
Else
=6
clearFlag = End If
False
If Len() = 2 And InStr(1, Text1, "0")=
=1 The n Text1 =
=Right(Text1, 1)
Cas