兩道VB程式設計題,求高手準確速度解答

2021-10-15 05:07:46 字數 1656 閱讀 7992

1樓:匿名使用者

第一個function myfun(x as single) as double

if x>=20 then

y=x*x+3*x+2

elseif x>=0 then

y=sqr(x*3)-2

else

y=abs(x)

end if

myfun=y

end function

第二個:

sub main()

x=inputbox("輸入十個評分,逗號分隔")dim sco(10) as stringdim min,max,sum as doublesco=spilit(x,",")

min=cint(sco(0))

max=cint(sco(0))

sum=cint(sco(0))

for i = 1 to 9

if cint(sco(i))max then max=cint(sco(i))

sum=sum+cint(sco(i))

next

msgbox "去掉最高分" & cstr(max) & "去掉最低分" & cstr(min) & "平均分是" & cstr((sum-max-min)/8)

end sub

2樓:匿名使用者

第一問:

public function fun(x as single) as single

if x >= 20 then

fun = x ^ 2 + x * 3 + 2

elseif x >= 0 then

fun = sqr(x * 3) - 2

else

fun = abs(x)

end if

end function

如果呼叫就這樣:

private sub form_load()

msgbox fun(19)

end sub

第二問:

private sub form_click()

dim a(1 to 10) as single, sum as single

dim i as integer, j as integer, t as single

for i = 1 to 10

a(i) = inputbox("請輸入第" & i & "個評分:")

sum = sum + a(i)

next i

for i = 1 to 9

for j = i + 1 to 10

if a(i) < a(j) then

t = a(i)

a(i) = a(j)

a(j) = t

end if

next j

next i

print "去掉一個最高分:"; a(1)

print "去掉一個最低分:"; a(10)

print "最後平均得分為:"; (sum - a(1) - a(10)) / 8

end sub

3樓:匿名使用者

額。。。太簡單了。。既然有人答了那就算了~

4樓:

留個郵箱,我把做好的程式發給你。(一看就會明白的)

兩道數學題怎么解,兩道數學題怎麼解?

y 2x 60 1x 2y 2這是一個方程組 將2式代1式得 y 4y 60 60 4y y 60 3y 60 3 y 20 y y 20 x 2y 2 20 40 不明白請追問.y 60 2x x y 3y 這是一個方程組?x 2y y 60 4y 3y 60,y 20 x 40 y 60 2x ...

幫我做兩道VB的題

一 1 dim m as integer,n as integer,i as integer for i 1 to 100 if i mod 3 0 then m m 1 if i mod 7 0 then n n 1 next i print 3的倍數 m 個 7的倍數 n 個 2 dim r a...

兩道數學題求高手解答,兩道小學數學題,應該對了,求解!

題16以為f,p分別為dc,db中點所以fp為1 2bc 同理pe為1 2a,又因為ad bc所以fp pe,所以fep為等腰三角形所以 pef pfe 18 題17de dg 1 2gc 2 因為dg de所以eg 4 ag be 5 又因為bg 3所以 bge為直角三角形,所以 bgc也是直角三...