⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 module1.bas

📁 计算器,和windows系统的相似的一个计算器
💻 BAS
字号:
Attribute VB_Name = "Module1"
Function fun(ByVal a As Double, ByVal i As Integer, ByVal flag As Integer)
  s = Str(a)
  pos = InStr(1, s, ".", vbBinaryCompare)
  If pos = 0 And flag = 1 Then
     s = s + "." + Str(i)
     a = Val(s)
  End If
  If pos = 0 And flag = 0 Then
      a = a * 10 + i
  End If
  If pos <> 0 Then
     s = s + Str(i)
     a = Val(s)
  End If
  fun = a
End Function

Function comput(ByVal a As Double, ByVal b As Double, index As Integer)
Select Case index
     Case 0: result = a / b
     Case 1: result = a * b
     Case 2: result = a - b
     Case 3: result = a + b
     Case 4: result = a Mod b
End Select
comput = result
End Function

Function convert(ByVal a As Double)
  s = Str(a)
  pos = InStr(1, s, "E", vbBinaryCompare)
  If a > -1 And a < 1 And a <> 0 And pos = 0 Then
     s = "0" + s
  End If
  pos = InStr(1, s, ".", vbBinaryCompare)
  If pos = 0 Then
     s = s + "."
  End If
  convert = s
End Function

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -