1樓:匿名使用者
1題private sub form_click()'隨機生成100個整數(本程式中整數數值設為10000以內)print "隨機生成100個整數"
dim i as integer, j as integer, md as integer
dim a(100) as integerq = 0
for i = 1 to 100
a(i) = rnd() * 10000
print a(i);
q = q + 1
if q = 10 then
q = 0
end if
next i
'按從小到大排序
print "按從小到大排序"
for i = 1 to 100
for j = i to 100
if a(i) > a(j) then
md = a(i)
a(i) = a(j)
a(j) = md
end if
next j
next i
q = 0
for i = 1 to 100
print a(i);
q = q + 1
if q = 10 then
q = 0
end if
next i
'按從大到小排序
print "按從大到小排序"
q = 0
for i = 100 to 1 step -1print a(i);
q = q + 1
if q = 10 then
q = 0
end if
next i
end sub
2題在form裡新增1個timer控制元件和1個label控制元件private sub form_click()'設定時間重新整理間隔為2秒
timer1.interval = 2000label1 = now()
end sub
private sub timer1_timer()label1 = now()
end sub
2樓:
排序: select * from [...] order by desc ‘倒序
vb程式設計問題:1使用隨機函式產生10個10~100之間的隨機整數存放在一維陣列a中,並把該陣列排序後顯示在一個
3樓:匿名使用者
根據已有的程式行,缺的內容主要就是一個排序過程。新增一個排序的過回
程就答行了。但是不知道該添在**,請說明程式的空白處是在**?能不能標出來,比如用括號,星號什麼的,標一下需要補充到**?
或者,能不能說明一下,各文字框,按鈕的功能是什麼? d = val(text3.text),這個應該是要插入的資料了,說明text3是用來輸入的,text2.
text = text2.text & str(a(i)),這說明text2是顯示排序後的結果的,
那有沒有text1?用作什麼?兩個按鈕定義的功能是什麼?插入的資料怎麼插?是隨機插入一個位置,並替換掉原來的資料還是將陣列重新定義隨機插入後,後面的數向後移?
這些需要說明一下,或者把需要填寫的位置標清楚,不然,不好確定該怎麼填。
vb程式設計,計算1+2+4+6+…+100的和 請用if語句~
4樓:聽不清啊
private sub command1_click()dim s as integer, i as integers = 1
for i = 2 to 100
if i mod 2 = 0 then s = s + inext i
print s
end sub
程式設計計算s=1+(1+2)+(1+2+3)+…+(1+2+3+4+…+100)的值?請各位用vb程式的**打出來。
5樓:匿名使用者
option explicit
private sub command1_click()dim i as integer
dim a as long
for i = 1 to 100
a = a + ss(i)
next i
print a
end sub
function ss(n as integer)dim i as integer
for i = 1 to n
ss = ss + n
next i
end function
vb程式設計:使用隨機函式產生50個10~100之間的互不相同的整數,存於一陣列中,並以升序每行10個數在**框上輸
6樓:聽不清啊
private sub command1_click()dim a(10 to 100) as booleanrandomize
n = 0
while n < 50
x = int(91 * rnd) + 10if not a(x) then
a(x) = true
n = n + 1
end if
wend
n = 0
for i = 10 to 100
if a(i) then
picture1.print i;
n = n + 1
if n mod 10 = 0 then picture1.print
end if
next i
picture1.print
end sub
求解兩道C 的題,謝謝大家,求助兩道C 程式設計題,謝謝!
include include include include include include include bool check and msg bool cdt,const char true msg 0,const char false msg 0 else return cdt bool ...
請VB高手做一道VB程式設計題,要速度解決,很急
dim miao as integer private form load timer1.interval 100 miao 0 end sub private timer1 timer label1.caption 現在的時間是 timer1.time str miao miao miao 1 i...
關於VB的一道題,關於VB的兩道題
private sub form keydown keycode as integer,shift as integer dim left,top as doubleleft top if keycode 37 then left 50elseif keycode 38 top 50 elseif ...