1.运行程序,输入参数,结果如下。
1.1 最大值
分别点击按钮:1、NextNum、3、NextNum、6,将三个数存入计算器中。
点击按钮:Max,结果如下:
1.2 总和
点击按钮:Sum,结果如下:
1.3 最小值
点击按钮:Min,结果如下:
1.4 平均值
点击按钮:Ave,结果如下:
1.5 计数
点击按钮:Counter,结果如下:
1.6 重试
点击按钮:Retry,结果如下:
2.部分源代码
Option Explicit
Dim counter As Integer
Dim data As Single
Dim max As Single
Dim min As Single
Dim sum As Single
Dim ave As Single
Private Sub Command10_Click()
Text1.Text = Text1.Text + "0"
End Sub
Private Sub Command1_Click()
Text1.Text = Text1.Text + "1"
End Sub
***
Private Sub Command13_Click()
Text1.Text = Val(min)
Text2.Text = "Min="
End Sub
Private Sub Command14_Click()
Text1.Text = Val(sum)
Text2.Text = "Sum="
End Sub
Private Sub Command15_Click()
Text1.Text = Val(sum / counter)
Text2.Text = "Ave="
End Sub
******
Private Sub Command18_Click()
Text1.Text = Val(counter)
Text2.Text = "Counter="
End Sub
Private Sub Command19_Click()
Text1.Text = "-" + Text1.Text
End Sub
Private Sub Command2_Click()
Text1.Text = Text1.Text + "2"
End Sub
Private Sub Command3_Click()
Text1.Text = Text1.Text + "3"
End Sub
Private Sub Command4_Click()
Text1.Text = Text1.Text + "4"
End Sub
Private Sub Command5_Click()
Text1.Text = Text1.Text + "5"
End Sub
Private Sub Command6_Click()
Text1.Text = Text1.Text + "6"
End Sub
Private Sub Command7_Click()
Text1.Text = Text1.Text + "7"
End Sub
Private Sub Command8_Click()
Text1.Text = Text1.Text + "8"
End Sub
Private Sub Command9_Click()
Text1.Text = Text1.Text + "9"
End Sub
Private Sub Command11_Click()
Text1.Text = Text1.Text + "."
End Sub
Private Sub Command17_Click()
Text1.Text = Val(max)
Text2.Text = "Max="
End Sub