1樓:
dim a as integer, b as integer, t as integer, s as integer
private sub command1_click()
if option1.value = true then
msgbox a & "+" & b & "=" & str(a + b)
else
if option2.value = true then
msgbox a & "-" & b & "=" & str(a - b)
end if
end if
text3.setfocus
end sub
private sub command2_click()
randomize (time())
if label1.caption = "-" then
doa = rnd(time()) * 99
b = rnd(time()) * 99
loop while a < b
else
if label1.caption = "+" then
a = rnd(time()) * 99
b = rnd(time()) * 99
end if
end if
text1.text = str(a)
text2.text = str(b)
if isnumeric(text1.text) = false or isnumeric(text2.text) = false then
msgbox "生成題目出錯!"
else
command2.enabled = false
end if
text1.enabled = false
text2.enabled = false
text3.setfocus
end sub
private sub command3_click()
select case label1.caption
case "+":
if isnumeric(text3.text) = false then
msgbox "答案輸入出錯!"
else
if (a + b) = val(text3.text) then
msgbox "正確!"
command2.caption = "再出一題(alt+&q)"
command2.enabled = true
text1.enabled = true
text2.enabled = true
s = s + 1
label4.caption = "已答對" & s & "道題目!"
else
msgbox "錯誤!"
end if
end if
case "-"
if isnumeric(text3.text) = false then
msgbox "答案輸入出錯!"
else
if (a - b) = val(text3.text) then
msgbox "正確!"
command2.caption = "再出一題(alt+&q)"
command2.enabled = true
text1.enabled = true
text2.enabled = true
s = s + 1
label4.caption = "已答對" & s & "道題目!"
else
msgbox "錯誤!"
end if
end if
end select
text3.text = ""
text3.setfocus
end sub
private sub command4_click()
s = 0
text1.text = ""
text2.text = ""
end sub
private sub command5_click()
endend sub
private sub form_load()
option1.value = true
s = 0
end sub
private sub option1_click()
if option1.value = true then
label1.caption = "+"
end if
end sub
private sub option2_click()
if option2.value = true then
label1.caption = "-"
end if
end sub
求大神幫忙用excel寫個vb程式題目,很簡單的
2樓:
函式就可以完成
還需要vba大炮?
或者是繁體的意思不同?
跪求大神幫忙用vb程式寫這道題!!!
3樓:
private sub command1_click()dim ts as integer,tv0 integer, tv1 as integer,ta as integer,tt as integer
tv0=40*1000/3600
tt=2*60
'先化簡,統一各單位 v=40km/h=100/9 m/s ,a = 0.15 m/s, t=120 s
tv1=tv0+ta*tt '由公式v2=v1+at得ts=tv0*tt+ta*(tt)^2/2 '由公式s=v0t+at^2/2得
text1.text=tv1 '2min後速度vtext2.text=ts '距開始點的距離send sub
『必要的話可以進行單位換算
求大神幫忙做一個vb題。題目如下
4樓:匿名使用者
private function fun(m as long) as string
dim flag as boolean
'**********program**********flag = true
for i = 2 to sqr(m)
if m mod i = 0 then
flag = false
exit for
end if
next
if flag then
fun = "素數"
else
fun = "非素數"
end if
'********** end **********end function
5樓:買雯爾念文
private
subform_click()
dimi%,
s%'i
迴圈bai變數du
,zhis
儲存dao累專加和屬
怎樣用vb程式將兩個文字框中的不同的數字找出來顯示在另文字框中
用兩個陣列儲存兩個文字框中的數字 然後套嵌兩個迴圈 外層迴圈用陣列1 內層迴圈用陣列2 找到相同的就忽略 不同的就記錄 假設文字框1中有10個數字 文字框2中有10個數字 文字框1用陣列a 9 記錄 文字框2用陣列b 9 記錄 下面是舉例說明 dim a as int32 dim b as int3...
C語言程式設計問題,求大神指教編寫程式,輸入兩個正整數m和n
include int main double sum int m,int n return s float sum 0 for i m i n i 用c語言編寫程式,輸入兩個正整數m和n,計算m n include void main for i 1 i n i sum0 sum1 sum2 pr...
求兩個用multisim設計的直流穩壓電源電路圖,是交流
主要是線性變壓器的設定 上傳 一張,要稽核,稍等。求一個用proteus 的直流穩壓電源,輸入220v交流電,經過變壓器,再經過整流濾波,穩壓。直流穩壓電源可以為負載提供穩定的直流電源,當交流供電電源的電壓或負載電阻變化時,穩壓器的直流輸出電壓都會保持穩定。直流穩壓電源的基本功能 工頻交流電源經過變...