作者在 2011-09-22 15:32:57 发布以下内容
我用的是VB6.0,自动求连续整数之和。
Private Sub Command1_Click()
Dim x As Long
Dim y As Long
Dim z As Long
Dim a As Long
z = 0
If Text1.Text = "" Then MsgBox "请输入起始值"
If Text2.Text = "" Then MsgBox "请输入截止值"
x = Text1.Text
y = Text2.Text
For a = x To y
z = z + a
Next a
Text3.Text = z
End Sub
Dim x As Long
Dim y As Long
Dim z As Long
Dim a As Long
z = 0
If Text1.Text = "" Then MsgBox "请输入起始值"
If Text2.Text = "" Then MsgBox "请输入截止值"
x = Text1.Text
y = Text2.Text
For a = x To y
z = z + a
Next a
Text3.Text = z
End Sub