vb程式設計 大一的 急求,VB程式設計 大一的 急求

2022-03-09 05:05:38 字數 3051 閱讀 8922

1樓:匿名使用者

你題目是1到100,每行輸出五個,而100裡只有35 和70能同時被5和7整除,所以我改了一下1000以內,如果要100以內,把1000改成100就可以了

private sub command1_click()

dim i as integer, n as integer

n = 0

for i = 1 to 1000

if i mod 5 = 0 and i mod 7 = 0 then

print i;

n = n + 1

if n = 5 then n = 0: print

end if

next i

end sub

第二題來了:

function fun(x as integer) as double

dim m as double

m = 1

for i = 1 to x

m = m * i

next i

fun = m

end function

private sub command1_click()

dim a as integer, b as integer, c as integer

dim s as integer

s = 0

a = val(text1.text)

b = val(text2.text)

c = val(text3.text)

s = fun(a) + fun(b) + fun(c)

print s

end sub

2樓:匿名使用者

1dim i as integer

dim s as single

dim stra as string

s = 0

for i = 1 to 100

if i mod 5 = 0 and i mod 7 = 0 then

s = s + 1

stra = stra & str(i) & " "

end if

if s = 5 then

print stra

s = 0

stra = ""

end if

next

print stra

2function jc(inta as integer) as long

dim i as integer

dim s as long

s = 1

for i = 1 to inta

s = s * i

next

jc = s

end function

dim s as long

s = jc(val(t1.text)) + jc(val(t2.text)) + jc(val(t3.text))

print s

急求!一道vb程式設計題 謝謝!

3樓:

private sub procmin(a() as integer, byval amin as integer)

dim i%, amin0%

for i = lbound(a) to ubound(a)print a(i);

amin0 = a(lbound(a))

if a(i) < amin0 then amin = a(i)next i

print

print "amin="; amin

end sub

private sub command1_click()dim a(1 to 10) as integer, i% ', amin0%

for i = 1 to 10

a(i) = int(501 * rnd + 300)next i

call procmin(a(), amin)end sub

4樓:匿名使用者

主程式dim a(10) as integerrandomize

for i = 0 to 9

a(i) = int((800 - 300 + 1) * rnd + 300)

next

procmin(a())

--子函式

function procmin(a() as integer) as integer

dim min as integer

min = a(0)

for i = 1 to 9

if min > a(i) then

min = a(i)

end if

next

procmin = min

end function

急求:vb程式設計教材答案

5樓:匿名使用者

function max(byval a as integer, byval b as integer, byval c as integer)

if max < a then max = aif max < b then max = bif max < c then max = cend function

private sub command1_click()dim a as integer, b as integer, c as integer, m as single

a = 2

b = 1

c = 3

m = max(a, b, c) / (max(a + b, b, c) * max(a, b, b + c))

print m

end sub

vb程式設計:1到m之間偶數之積 10

6樓:

dim sum as long,i as integersum=0

m=100

for i=2 to m step 2

sum=sum+i

next i

急求!一道VB程式設計題謝謝,10道VB題 急求答案!!!謝謝高手了

private sub procmin a as integer,byval amin as integer dim i amin0 for i lbound a to ubound a print a i amin0 a lbound a if a i amin0 then amin a i ne...

vb程式設計題求大神解答,VB程式設計軟體題目,求大神解答謝謝

private sub mand1 click if val text1.text 7 or val text1.text 1 then msgbox 有效數字輸入範圍1 7 exit sub end if text2.text choose val text1.text 一 二 三 四 五 六 日...

求解VB程式設計題(初學者),請教一道VB陣列程式設計題(大學初學者),謝謝!!!

恕我直言,要查錯遠遠比解題麻煩多了.所以,如果可以,請把題目補充出來,晚一點我再看回來.祝好運.我也貼一段 function ishuiwen n as double as boolean 判斷是否迴文數 ishuiwen false dim m,i as double m 0 i n while ...