VB6.0编程 手动输入数据,计算求和,平均值,差值,平方后开方再分类 代码讨论
本人要做一个程序, 交互式窗口,手动输入100个数据,求平均值、平方后再开方和自动分类,程序功能:1、手动指定录入1-100任意个数据,数据类型double;
2、计算录入的数据个数n;
3、求n个数据的平均值;
4、n个数据每一个与其平均值的差;
5、第4步计算的每一个数据平方再开方,这个值假定代号为X;
6、第5步计算的值分类,分五类:A+类:X≥1.67;A类:1.33≤X<1.67;B类:1.0≤X<1.33;C类:0.67≤X<1.0;D类:X<0.67。
程序界面如图中所示要求,我做到了求和,但不会统计textbox有效数据个数,做不到后面的功能, 求高手指点迷津!!!
程序代码如下:
Private Sub Command1_Click()
Dim t As Double, i As Double, a As Double, b As Double, c As Double, d As Double, e As Double, f As Double, g As Double, h As Double, j As Double, k As Double, l As Double, m As Double, n As Double, p As Double
i = Val(Text1.Text) + Val(Text2.Text) + Val(Text3.Text) + Val(Text4.Text) + Val(Text5.Text) + Val(Text6.Text) + Val(Text7.Text)
a = Val(Text8.Text) + Val(Text9.Text) + Val(Text10.Text) + Val(Text11.Text) + Val(Text12.Text) + Val(Text13.Text) + Val(Text14.Text)
b = Val(Text15.Text) + Val(Text16.Text) + Val(Text17.Text) + Val(Text18.Text) + Val(Text19.Text) + Val(Text20.Text) + Val(Text21.Text)
c = Val(Text22.Text) + Val(Text23.Text) + Val(Text24.Text) + Val(Text25.Text) + Val(Text26.Text) + Val(Text27.Text) + Val(Text28.Text)
d = Val(Text29.Text) + Val(Text30.Text) + Val(Text31.Text) + Val(Text32.Text) + Val(Text33.Text) + Val(Text34.Text) + Val(Text35.Text)
e = Val(Text36.Text) + Val(Text37.Text) + Val(Text38.Text) + Val(Text39.Text) + Val(Text40.Text) + Val(Text41.Text) + Val(Text42.Text)
f = Val(Text43.Text) + Val(Text44.Text) + Val(Text45.Text) + Val(Text46.Text) + Val(Text47.Text) + Val(Text48.Text) + Val(Text49.Text)
g = Val(Text50.Text) + Val(Text51.Text) + Val(Text52.Text) + Val(Text53.Text) + Val(Text54.Text) + Val(Text55.Text)
h = Val(Text56.Text) + Val(Text57.Text) + Val(Text58.Text) + Val(Text59.Text) + Val(Text60.Text) + Val(Text61.Text)
j = Val(Text62.Text) + Val(Text63.Text) + Val(Text64.Text) + Val(Text65.Text) + Val(Text66.Text) + Val(Text67.Text) + Val(Text68.Text)
k = Val(Text69.Text) + Val(Text70.Text) + Val(Text71.Text) + Val(Text72.Text) + Val(Text73.Text) + Val(Text74.Text) + Val(Text75.Text)
l = Val(Text76.Text) + Val(Text77.Text) + Val(Text78.Text) + Val(Text79.Text) + Val(Text80.Text) + Val(Text81.Text) + Val(Text82.Text)
m = Val(Text83.Text) + Val(Text84.Text) + Val(Text85.Text) + Val(Text86.Text) + Val(Text87.Text) + Val(Text88.Text) + Val(Text89.Text)
n = Val(Text90.Text) + Val(Text91.Text) + Val(Text92.Text) + Val(Text93.Text) + Val(Text94.Text) + Val(Text95.Text) + Val(Text96.Text)
p = Val(Text97.Text) + Val(Text98.Text) + Val(Text99.Text) + Val(Text100.Text)
t = i + a + b + c + d + e + f + g + h + j + k + l + m + n + p
Picture6.Print t
End Sub
Private Sub Picture6_Click()
Picture6.Cls
End Sub
Private Sub Text1_Change()
Dim Text1 As Double
End Sub
Private Sub Text10_Change()
Dim Text10 As Double
End Sub
Private Sub Text100_Change()
Dim Text100 As Double
End Sub
Private Sub Text101_Change()
Dim text101 As Double
i = text101
End Sub
Private Sub Text11_Change()
Dim Text11 As Double
End Sub
Private Sub Text12_Change()
Dim Text12 As Double
End Sub
Private Sub Text13_Change()
Dim Text13 As Double
End Sub
Private Sub Text14_Change()
Dim Text14 As Double
End Sub
Private Sub Text15_Change()
Dim Text15 As Double
End Sub
Private Sub Text16_Change()
Dim Text16 As Double
End Sub
Private Sub Text17_Change()
Dim Text17 As Double
End Sub
Private Sub Text18_Change()
Dim Text18 As Double
End Sub
Private Sub Text19_Change()
Dim Text19 As Double
End Sub
Private Sub Text2_Change()
Dim Text2 As Double
End Sub
Private Sub Text20_Change()
Dim Text20 As Double
End Sub
Private Sub Text21_Change()
Dim Text21 As Double
End Sub
Private Sub Text22_Change()
Dim Text22 As Double
End Sub
Private Sub Text23_Change()
Dim Text23 As Double
End Sub
Private Sub Text24_Change()
Dim Text24 As Double
End Sub
Private Sub Text25_Change()
Dim Text25 As Double
End Sub
Private Sub Text26_Change()
Dim Text26 As Double
End Sub
Private Sub Text27_Change()
Dim Text27 As Double
End Sub
Private Sub Text28_Change()
Dim Text28 As Double
End Sub
Private Sub Text29_Change()
Dim Text29 As Double
End Sub
Private Sub Text3_Change()
Dim Text3 As Double
End Sub
Private Sub Text30_Change()
Dim Text30 As Double
End Sub
Private Sub Text31_Change()
Dim Text31 As Double
End Sub
Private Sub Text32_Change()
Dim Text32 As Double
End Sub
Private Sub Text33_Change()
Dim Text33 As Double
End Sub
Private Sub Text34_Change()
Dim Text34 As Double
End Sub
Private Sub Text35_Change()
Dim Text35 As Double
End Sub
Private Sub Text36_Change()
Dim Text36 As Double
End Sub
Private Sub Text37_Change()
Dim Text37 As Double
End Sub
Private Sub Text38_Change()
Dim Text38 As Double
End Sub
Private Sub Text39_Change()
Dim Text39 As Double
End Sub
Private Sub Text4_Change()
Dim Text4 As Double
End Sub
Private Sub Text40_Change()
Dim Text40 As Double
End Sub
Private Sub Text41_Change()
Dim Text41 As Double
End Sub
Private Sub Text42_Change()
Dim Text42 As Double
End Sub
Private Sub Text43_Change()
Dim Text43 As Double
End Sub
Private Sub Text44_Change()
Dim Text44 As Double
End Sub
Private Sub Text45_Change()
Dim Text45 As Double
End Sub
Private Sub Text46_Change()
Dim Text46 As Double
End Sub
Private Sub Text47_Change()
Dim Text47 As Double
End Sub
Private Sub Text48_Change()
Dim Text48 As Double
End Sub
Private Sub Text49_Change()
Dim Text49 As Double
End Sub
Private Sub Text5_Change()
Dim Text5 As Double
End Sub
Private Sub Text50_Change()
Dim Text50 As Double
End Sub
Private Sub Text51_Change()
Dim Text51 As Double
End Sub
Private Sub Text52_Change()
Dim Text52 As Double
End Sub
Private Sub Text53_Change()
Dim Text53 As Double
End Sub
Private Sub Text54_Change()
Dim Text54 As Double
End Sub
Private Sub Text55_Change()
Dim Text55 As Double
End Sub
Private Sub Text56_Change()
Dim Text56 As Double
End Sub
Private Sub Text57_Change()
Dim Text57 As Double
End Sub
Private Sub Text58_Change()
Dim Text58 As Double
End Sub
Private Sub Text59_Change()
Dim Text59 As Double
End Sub
Private Sub Text6_Change()
Dim Text6 As Double
End Sub
Private Sub Text60_Change()
Dim Text60 As Double
End Sub
Private Sub Text61_Change()
Dim Text61 As Double
End Sub
Private Sub Text62_Change()
Dim Text62 As Double
End Sub
Private Sub Text63_Change()
Dim Text63 As Double
End Sub
Private Sub Text64_Change()
Dim Text64 As Double
End Sub
Private Sub Text65_Change()
Dim Text65 As Double
End Sub
Private Sub Text66_Change()
Dim Text66 As Double
End Sub
Private Sub Text67_Change()
Dim Text67 As Double
End Sub
Private Sub Text68_Change()
Dim Text68 As Double
End Sub
Private Sub Text69_Change()
Dim Text69 As Double
End Sub
Private Sub Text7_Change()
Dim Text7 As Double
End Sub
Private Sub Text70_Change()
Dim Text70 As Double
End Sub
Private Sub Text71_Change()
Dim Text71 As Double
End Sub
Private Sub Text72_Change()
Dim Text72 As Double
End Sub
Private Sub Text73_Change()
Dim Text73 As Double
End Sub
Private Sub Text74_Change()
Dim Text74 As Double
End Sub
Private Sub Text75_Change()
Dim Text75 As Double
End Sub
Private Sub Text76_Change()
Dim Text76 As Double
End Sub
Private Sub Text77_Change()
Dim Text77 As Double
End Sub
Private Sub Text78_Change()
Dim Text78 As Double
End Sub
Private Sub Text79_Change()
Dim Text79 As Double
End Sub
Private Sub Text8_Change()
Dim Text8 As Double
End Sub
Private Sub Text80_Change()
Dim Text80 As Double
End Sub
Private Sub Text81_Change()
Dim Text81 As Double
End Sub
Private Sub Text82_Change()
Dim Text82 As Double
End Sub
Private Sub Text83_Change()
Dim Text83 As Double
End Sub
Private Sub Text84_Change()
Dim Text84 As Double
End Sub
Private Sub Text85_Change()
Dim Text85 As Double
End Sub
Private Sub Text86_Change()
Dim Text86 As Double
End Sub
Private Sub Text87_Change()
Dim Text87 As Double
End Sub
Private Sub Text88_Change()
Dim Text88 As Double
End Sub
Private Sub Text89_Change()
Dim Text89 As Double
End Sub
Private Sub Text9_Change()
Dim Text9 As Double
End Sub
Private Sub Text90_Change()
Dim Text90 As Double
End Sub
Private Sub Text91_Change()
Dim Text91 As Double
End Sub
Private Sub Text92_Change()
Dim Text92 As Double
End Sub
Private Sub Text93_Change()
Dim Text93 As Double
End Sub
Private Sub Text94_Change()
Dim Text94 As Double
End Sub
Private Sub Text95_Change()
Dim Text95 As Double
End Sub
Private Sub Text96_Change()
Dim Text96 As Double
End Sub
Private Sub Text97_Change()
Dim Text97 As Double
End Sub
Private Sub Text98_Change()
Dim Text98 As Double
End Sub
Private Sub Text99_Change()
Dim Text99 As Double
End Sub