vb程式設計教程答案,vb程式設計教程答案

2021-12-22 05:33:31 字數 3036 閱讀 2143

1樓:揭莞然

option explicit

private sub command1_click()dim a() as integer

dim i, j, n

redim a(9, 9)

for i = 1 to 8

print tab(25 - i * 2);

for j = 1 to i

a(i, 1) = 1

a(i, i) = 1

a(i + 1, j + 1) = a(i, j) + a(i, j + 1)

print a(i, j);

next j

print

next i

end sub

2樓:

private sub form_load()me.autoredraw = true

dim n as integer, i as integer, j as integer

n = 8

dim ss() as integer

redim ss(1 to n, 1 to n)for i = 1 to n

ss(i, 1) = 1

ss(i, i) = 1

next

for i = 3 to n

for j = 2 to i - 1

ss(i, j) = ss(i - 1, j - 1) + ss(i - 1, j)

next

next

for i = 1 to n

for j = 1 to i

print ss(i, j) & vbtab;

next

print

next

end sub

3樓:匿名使用者

dim a as integer

dim i as integer = 0

dim forty as integer = 0dim seventy as integer = 0dim aboveseventy as integer = 0for i = 0 to 99

randomize()

a = 100 * rnd()

if (a < 40) then

forty += 1

elseif a >= 40 and a <= 70 thenseventy += 1

else

aboveseventy += 1

end if

next

messagebox.show(forty & " " & seventy & " " & aboveseventy)

vb程式設計教程答案 15

4樓:薔薇霓冰

先插入三個textbox 控制元件 textbox1 textbox2 textbox3用於輸入a、b、c三個數

再插入兩個label控制元件label1、label2用於顯示最大值與最小值

最後插入一個button控制元件

雙擊button控制元件輸入以下**即可

private sub button1_click(byval sender as system.object, byval e as system.eventargs) handles button1.

click

dim a, b, c as integera = cint(textbox1.text)b = cint(textbox2.text)c = cint(textbox3.

text)if a > b and b > c thenlabel1.text = cstr(a)label2.text = cstr(c)end if

if a > c and c > b thenlabel1.text = cstr(a)label2.text = cstr(b)end if

if b > a and a > c thenlabel1.text = cstr(b)label2.text = cstr(c)end if

if b > c and c > a thenlabel1.text = cstr(b)label2.text = cstr(a)end if

if c > b and b > a thenlabel1.text = cstr(c)label2.text = cstr(a)end if

if c > a and a > b thenlabel1.text = cstr(c)label2.text = cstr(b)end if

end sub

可能有更簡便的方法

5樓:匿名使用者

private sub command1_click()

if val(text1.text) < val(text2.text) then

label1.caption = "最小數:" & iif(val(text1.

text) < val(text3.text), text1.text, text3.

text)

label2.caption = "最大數:" & iif(val(text2.

text) < val(text3.text), text3.text, text2.

text)

else

label1.caption = "最小數:" & iif(val(text2.

text) < val(text3.text), text2.text, text3.

text)

label2.caption = "最大數:" & iif(val(text1.

text) < val(text3.text), text3.text, text1.

text)

end if

end sub

6樓:撒迎彤

首先宣告變數abc

abc賦值 文字框.

在用判斷語句

判斷那個數值比較大...

判斷之後賦值abc為標籤的標題.

結束判斷語句

vb程式設計計算,VB程式設計計算 1 2

private sub command1 click dim i as integer,j as integerdim l as long,h as longfor i 1 to 10 h 1 for j 1 to i h h j next l l h next print l end sub pr...

VB程式設計計算s123,VB程式設計計算s

function ss tos as integer as integer tos參與復計算 制的最後一個數 dim i as integer ss 0 for i 1 to tos if i mod 2 0 then ss ss i else ss ss i end if next end fun...

VB程式設計,高分值

底1題 dim i as integer dim j as integer dim i17 as integer dim i27 as integer dim minc as integer 1000dim c as integer for i 1 to 1000 27 17for j 1 to 1...