VB一题
我学VB没多久。。。。。会VB的,,能帮俺解决这道VB题吗???十分感谢。。。。极需???题是:(计算出50以内两个数之间(包括开头和结尾的数)所有连续数的和为120的正整数,并在窗体上显示出来,程序输出每组开头和结尾的正整数,并用“~”连接起来,如1~15,这样的数有多组,一行输出一组。) --------------------编程问答-------------------- 此类问题请用递归算法 --------------------编程问答-------------------- Try it.
--------------------编程问答-------------------- 那请问下这题界面要咋做???谢谢。。。 --------------------编程问答-------------------- ???这东东还要什么界面?? --------------------编程问答--------------------
Private Sub Form_Load()
Me.AutoRedraw = True
Dim i As Integer
Dim j As Integer
Dim sum As Integer
Dim recordCount As Integer
Dim strToPrint As String
For i = 1 To 50
'Initilize one loop
j = i
sum = 0
strToPrint = ""
While sum < 120
sum = sum + j
strToPrint = strToPrint & "~" & j
j = j + 1
Wend
If sum = 120 Then
Me.Print strToPrint
recordCount = recordCount + 1
End If
Next i
Me.Print "There are " & recordCount & " records."
End Sub
VB code
Private Sub Commond_Click()
Me.AutoRedraw = True
Dim i As Integer
Dim j As Integer
Dim sum As Integer
Dim recordCount As Integer
Dim strToPrint As String
For i =……
[/Quote]
添加一个命令按钮,再添加一个或者多个Label或者ListBox都成
补充:VB , 基础类