作业帮 > 综合 > 作业

Private Sub Command1_Click() A = Val(Text1.Text):B = Val(Tex

来源:学生作业帮 编辑:搜狗做题网作业帮 分类:综合作业 时间:2024/04/29 20:10:41
Private Sub Command1_Click() A = Val(Text1.Text):B = Val(Text2.Text) For M = A To B M = M + 1 Next
Private Sub Command1_Click()
A = Val(Text1.Text):B = Val(Text2.Text)
For M = A To B
M = M + 1
Next M
Label1 = M
End Sub
当A为1,B为2时,运行出来为什么是5呢?
应该是A为1,B 为3
Private Sub Command1_Click() A = Val(Text1.Text):B = Val(Tex
下面是根据你的程序改起来的,改动的地方就是把Form_load函数中的40个双引号去掉
Option Explicit
Option Base 1
Const num = 10
Dim a(num) As Single,b(num) As Single,c(num) As Single
Dim x As Single,m As Single
Dim sum As Single,i As Integer
Private Sub Command1_Click()
sum = 0
For i = 1 To num
c(i) = ((a(i) - 60) / 10 + 1) * b(i)
sum = sum + c(i)
Next i
x = sum / m
Print "Text00.Text"; x
End Sub
Private Sub Form_Load()
a(1) = Val(Text1.Text) '各科成绩
a(2) = Val(Text2.Text)
a(3) = Val(Text3.Text)
a(4) = Val(Text4.Text)
a(5) = Val(Text5.Text)
a(6) = Val(Text6.Text)
a(7) = Val(Text7.Text)
a(8) = Val(Text8.Text)
a(9) = Val(Text9.Text)
a(10) = Val(Text10.Text)
b(1) = Val(Text11.Text) '各科学分
b(2) = Val(Text12.Text)
b(3) = Val(Text13.Text)
b(4) = Val(Text14.Text)
b(5) = Val(Text15.Text)
b(6) = Val(Text16.Text)
b(7) = Val(Text17.Text)
b(8) = Val(Text18.Text)
b(9) = Val(Text19.Text)
b(10) = Val(Text20.Text)
m = Val(Text0.Text) '总学分
End Sub
我觉得,你的程序的一个闪光点就是
c(i) = ((a(i) - 60) / 10 + 1) * b(i)
这一句.如果这句是你自己写的,那证明你还是很有想法的