壹個數組放數的a(1 to 999)as integer,j as integer
j=1
然後壹個for循環 for i=0 to 999 do
begin
第壹個數字可以用 a=i div 100
第二個數字可以用b=(i-a*100) div 10
第三個數字可以用 c=i-a*100-b*10
兩個相反條件 if a+b+c > 5 & c <> 3 then
begin
放到數組裏 a(j)=i
j=j+1
end
大概就這樣了,呵呵
--------------------------
給妳個代碼如下:
新建壹個工程,在對話框上按照妳的意願畫上壹個按鈕command1,壹個文本框text1,雙擊command1
粘貼這段代碼,我完全是在這裏打的,我沒有編譯器,但我盡力了
---------------------
Private Sub Command1_Click()
dim i as integer
dim a as integer
dim b as integer
dim c as integer
dim x as string
dim y as string
dim m as string
dim n as string
TextText = ""
x=InputBox("您希望組合之和小於?","條件壹")
y=InputBox("您希望第壹位為?(不確定留空)","條件二")
m=InputBox("您希望第二位為?(不確定留空)","條件三")
n=InputBox("您希望第三位為?(不確定留空)","條件四")
For i = 0 To 999 do
a=i div 100
b=(i-a*100) div 10
c=i-a*100-b*10
if y="" then y=format(a)
if m="" then m=format(b)
if n="" then n=format(c)
if a+b+c < x & a=cint(y) & b=cint(m) & c=cint(n) then Text1.Text =Text1.Text + chr(13)+chr(10)+format(i)
next i
End Sub