VERSION 5.00
Begin VB.Form Form2
AutoRedraw = -1 'True
Caption = "计算界面"
ClientHeight = 4905
ClientLeft = 4965
ClientTop = 3630
ClientWidth = 5715
LinkTopic = "Form2"
ScaleHeight = 4905
ScaleWidth = 5715
Begin VB.CommandButton Command1
Caption = "计算"
Height = 495
Left = 2520
TabIndex = 11
Top = 240
Width = 1335
End
Begin VB.CommandButton Command2
Caption = "清空"
Height = 495
Left = 4320
TabIndex = 12
Top = 240
Width = 1095
End
Begin VB.TextBox Text8
Height = 615
Left = 4440
TabIndex = 10
Top = 3600
Width = 1095
End
Begin VB.TextBox Text7
Height = 615
Left = 1920
TabIndex = 8
Top = 3600
Width = 975
End
Begin VB.TextBox Text6
Height = 615
Left = 3960
TabIndex = 6
Top = 2160
Width = 1215
End
Begin VB.TextBox Text5
Height = 615
Left = 2280
TabIndex = 5
Top = 2160
Width = 1095
End
Begin VB.TextBox Text4
Height = 735
Left = 600
TabIndex = 4
Top = 2040
Width = 1215
End
Begin VB.TextBox Text3
Height = 735
Left = 3960
TabIndex = 3
Top = 1080
Width = 1215
End
Begin VB.TextBox Text2
Height = 615
Left = 2280
TabIndex = 2
Top = 1080
Width = 1095
End
Begin VB.TextBox Text1
Height = 615
Left = 600
TabIndex = 1
Top = 1080
Width = 1215
End
Begin VB.Label Label3
Caption = "六个数的平均数的平方:"
Height = 615
Left = 3240
TabIndex = 9
Top = 3600
Width = 855
End
Begin VB.Label Label2
Caption = "六个数中的最大值:"
Height = 495
Left = 480
TabIndex = 7
Top = 3600
Width = 1095
End
Begin VB.Label Label1
Caption = "请输入六个自然数:"
Height = 375
Left = 360
TabIndex = 0
Top = 240
Width = 1695
End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Function Max(Arr As Variant)
Max = Arr(0)
For i = 0 To UBound(Arr)
If Arr(i) > Max Then Max = Arr(i)
Next
End Function
Private Sub Command1_Click()
Arr = Array(Text1.Text, Text2.Text, Text3.Text, Text4.Text, Text5.Text, Text6.Text)
Text7.Text = Max(Arr)
Text8.Text = Str$(((Val(Text1.Text) + Val(Text2.Text) + Val(Text3.Text) + Val(Text4.Text) + Val(Text5.Text) + Val(Text6.Text)) * (Val(Text1.Text) + Val(Text2.Text) + Val(Text3.Text) + Val(Text4.Text) + Val(Text5.Text) + Val(Text6.Text))) / Val(36))
End Sub
Private Sub Command2_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
End Sub