求vb大神解答這道題,求大神解答一下這道vb題的程式碼

2021-03-04 03:29:14 字數 5722 閱讀 3091

1樓:匿名使用者

private sub form_click()

dim intmax as integer, intmaxid as integer, intmin as integer, intminid as integer

dim intsum as integer, intcount as integer, intpasscount as integer

intmax = 0: intmin = 100

for i = 1 to len(text1.text) step 2

if asc(mid(text1.text, i, 1)) >= 48 and asc(mid(text1.text, i, 1)) <= 57 then

intcount = intcount + 1

if val(mid(text1.text, i, 2)) >= 60 then intpasscount = intpasscount + 1

intsum = intsum + val(mid(text1.text, i, 2))

if val(mid(text1.text, i, 2)) > intmax then intmax = val(mid(text1.text, i, 2)):

 intmaxid = intcount

if val(mid(text1.text, i, 2)) < intmin then intmin = val(mid(text1.text, i, 2)):

 intminid = intcount

end if

next i

text2.text = intmax & "分,學號" & intmaxid

text3.text = intmin & ",學號" & intminid

text4.text = format(intsum / intcount, "0.00")

text5.text = intpasscount & ",及格率:" & format(intpasscount / intcount * 100, "0.00") & "%"

end sub

求大神解答一下這道vb題的**

2樓:聽不清啊

private sub ***mand1_click()list1.removeitem list1.listindexend sub

private sub ***mand2_click()list1.clear

end sub

private sub form_load()randomize

form1.caption = "列表框應用"

***mand1.caption = "刪除"

***mand2.caption = "清除"

for i = 1 to 8

x = int(rnd * 90) + 10list1.additem x

next i

end sub

3樓:匿名使用者

這個就是呼叫列表框控制元件的 remove 和 clear 。

求大神解答3道vb題。。。。

4樓:匿名使用者

一、private sub ***mand1_click()randomize

dim x(1 to 50) as integerfor i = 1 to 50

x(i) = int(rnd() * 101) + 100if x(i) mod 7 = 0 then print x(i)next i

end sub

二、private sub ***mand1_click()zf = "我喜歡"

if ch1.value = 1 then zf = zf & ch1.caption & "、"

if ch2.value = 1 then zf = zf & ch2.caption & "、"

if ch3.value = 1 then zf = zf & ch3.caption & "、"

text1 = mid(zf, 1, len(zf) - 1)end sub

private sub form_load()ch1.caption = "游泳"

ch2.caption = "體操"

ch3.caption = "滑冰"

text1 = ""

end sub

三、private sub ***mand1_click()if val(text1) < 1 thenmsgbox "請輸入數字!"

exit sub

end if

text1 = val(text1)

if option1.value = true thentext2 = jsh

elseif option2.value = true thentext2 = osh

elseif option3.value = true thentext2 = pfh

else

text2 = lfh

end if

end sub

private sub form_load()option1.caption = "偶數和"option2.caption = "奇數和"

option3.caption = "平方和"

option4.caption = "立方和"

end sub

private function jsh()k = val(text1)

for i = 1 to k step 2jsh = jsh + i

next i

end function

private function osh()k = val(text1)

for i = 2 to k step 2osh = osh + i

next i

end function

private function pfh()k = val(text1)

for i = 1 to k

pfh = pfh + i ^ 2

next i

end function

private function lfh()k = val(text1)

for i = 1 to k

lfh = lfh + i ^ 3

next i

end function

5樓:匿名使用者

第一題dim i as integer, data(10) as integer

for i = 0 to 10

data(i) = rnd(now) * 100 + 100next i

for i = 0 to 10

if data(i) mod 7 = 0 thenform1.print data(i)

end if

next i

6樓:匿名使用者

第1題:

dim a(121) as integer

dim x as integer

private sub form_load()

randomize

for x = 0 to 120

a(x) = int(rnd * 101 + 100)

if a(x) mod 7 = 0 then

print a(x)

end if

next x

end sub

第2題:

text1.text = "我喜歡"

if check1.value = 1 then

text1.text = text1.text & check1.caption

end if

if check2.value = 1 then

text1.text = text1.text & check2.caption

end if

if check3.value = 1 then

text1.text = text1.text & check3.caption

end if

第3題:

dim i, j as integer

sub op1(x as integer)

j = 0

for i = 0 to x

if i mod 2 = 0 then

j = j + i

end if

next i

text2.text = text2.text & "偶數和:" & i

end sub

sub op2(x as integer)

j = 0

for i = 0 to x

if i mod 2 <> 0 then

j = j + i

end if

next i

text2.text = text2.text & "奇數和:" & i

end sub

sub op3(x as integer)

j = 0

for i = 0 to x

j = j + i * i

next i

text2.text = text2.text & "平方和:" & i

end sub

sub op4(x as integer)

j = 0

for i = 0 to x

j = j + i * i * i

next i

text2.text = text2.text & "立方和:" & i

end sub

private sub ***mand1_click()

dim y as integer

if text1.text = "" or (not isnumeric(text1.text)) then

msgbox "輸入錯誤,請重新輸入"

else

y = val(text1.text)

if option1.value = true then

op1 (y)

end if

if option2.value = true then

op2 (y)

end if

if option3.value = true then

op3 (y)

end if

if option4.value = true then

op4 (y)

end if

end if

end sub

private sub form_load()

option1.value = true

end sub

行不???

求大神用vb做出這道題。一輛卡車違反交通規則,撞人後逃跑。現場有三人目擊該事件,但都沒有記住車號,

7樓:匿名使用者

這個就是列舉演算法,使用迴圈來做,利用計算機的高速度,一個一個「猜」,用數學式子去驗證。

假設四位數字,從左到右為:abcd

for a= 0 to 9

for b= 0 to 9

for c= 0 to 9

for d= 0 to 9

'在這裡根據三個人的描述,進行判斷

next d

next c

next b

next a

求各位大神解這道題求大神解答!這道題怎麼寫?

你要明白煎三張餅只須三分鐘 先用一分鐘煎熟兩個餅的一面,然後其中一個餅翻面,另一個取下,放新餅,一分鐘後熟的取下,另一個翻面,再把前面沒煎熟的放上,一分鐘後就都熟了。總共三分鐘。所以,15 張餅最少需要 15 分鐘 實際中可以一開始先消耗1分鐘煎兩張餅的同一面,再將一張煎熟一面的取下換成新餅,剩下的...

VB題,求各位大神解答,一些VB題目,求大神解答

username textbox1.textpassword textbox2.textbutton1 click if username abcde and password 12345 then frmlogin.show else msgbox 密碼有誤 textbox1.setfocus t...

求大神幫忙解答,這道題實在不會

在我國少數民族中,從事農業生產的佔大多數,他們雖然都以糧食作物為主食,但飲食習慣不盡相同。北方的朝鮮族 回族,新疆的維吾爾族和南方大部分民族主要食用粳米,而傣 侗和水族等嗜食糯米。居住在高原 山區以及北方平原地區的民族主食品種繁多,五穀雜糧俱食。在食品做法上,各民族之間也不完全相同。佤族 黎族喜歡用...