當前位置:編程學習大全網 - 源碼下載 - 用VB來剔除壹些數字

用VB來剔除壹些數字

給妳個提示,其實很簡單

壹個數組放數的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

  • 上一篇:WIN7淘寶買的激活碼激活,壹開始聯網不能激活
  • 下一篇:線程調用handler會導致內存泄露嗎
  • copyright 2024編程學習大全網