如题:
int a = 11;
int[] x = new int[]{2,7,5,3,4};
求 11 = 2 + 5 + 4;或者 11 = 7 + 4;
好久没来了,顺便向坚守vb的人们致敬......
int a = 11;
int[] x = new int[]{2,7,5,3,4};
求 11 = 2 + 5 + 4;或者 11 = 7 + 4;
好久没来了,顺便向坚守vb的人们致敬......
解决方案 »
- 打印新问题
- 一个sleep的问题.,好奇怪.
- 输入某一天的日期,怎样知道这一天是星期几
- 请问在vb中如何实现不添加adodc控件,而纯用代码实现连接access2000数据库
- 帮忙看,这个语句有什么错误.谢谢
- 探讨一下字符串的问题
- 在vb中如何将函数的值付值给一个变量
- 如何用oleacc获得谷歌浏览器v29的url
- 菜鸟请教不菜的鸟(关于TreeView)
- 我想做一个平滑的进度条,但我怎么也实现不了在其中显示的文字(如78%)能够一半白色而另一半蓝色,而且是在每个字在都要实现这种效果,怎么办,我用的是textout的API函数
- 读图片的问题...请教大虾....
- 有没有api可以通过进程号结束进程
Form1
Text1
Command1
Command2
Option ExplicitType Ntype
Num As Integer
Select As Boolean
End TypePublic N() As Ntype
Public Pointer As IntegerPublic Function ShowSNum() As String '显示已选的数
Dim I As Integer, tmp As String
For I = 1 To Pointer
If N(I - 1).Select Then
tmp = tmp & Str(N(I - 1).Num) & " "
End If
Next I
ShowSNum = tmp
End FunctionPublic Function NSelect() As Integer '已选数的个数
Dim I As Integer, S As Integer
S = 0
For I = 1 To Pointer
If N(I - 1).Select Then
S = S + 1
End If
Next I
NSelect = S
End FunctionPublic Function ShowAll(P As Integer) As String '显示函数
Dim I As Integer
If NSelect = 10 Then
ShowAll = ShowSNum + Chr(13) + Chr(10)
Else
For I = P To Pointer '体现选择的单向性,因为是组合不是排列
N(I - 1).Select = True
Form1.Text1.SelText = ShowAll(I + 1) '用一个文本框保存结果
N(I - 1).Select = False
Next I
End If
End Function
Private Sub Command1_Click()
Dim I As Integer
Pointer = InputBox("想生成几个数据?", "Input Number")
ReDim N(Pointer - 1)
N(0).Num = Int(Rnd(1) * 10)
N(0).Select = False
Text1.SelText = Str(N(0).Num) & " "
For I = 1 To Pointer - 1
N(I).Num = N(I - 1).Num + Int(Rnd(1) * 5 + 1)
N(I).Select = False
Text1.SelText = Str(N(I).Num) & " "
Next I
Text1.SelText = Chr(13) & Chr(10)
End SubPrivate Sub Command2_Click()
ShowAll (1)
End Sub
Dim num(1 To 10) As Long
Dim i As Long
For i = 1 To 10
num(i) = i
Next
For i = 1 To 10
SumX CStr(num(i)), num(i), 11, i + 1, num
Next
End SubPrivate Sub SumX(strPre As String, nOp1 As Long, nSum As Long, nStart As Long, aArr() As Long)
Dim i As Long
For i = nStart To UBound(aArr)
If nOp1 + aArr(i) = nSum Then
Debug.Print strPre & "+" & CStr(aArr(i)) & "=" & CStr(nSum)
End If
SumX strPre & "+" & CStr(aArr(i)), nOp1 + aArr(i), nSum, i + 1, aArr()
Next
End Sub