VB設計小學算術題出題程式,VB設計一個小學算術題出題程式

2022-08-02 06:25:19 字數 5163 閱讀 1173

1樓:匿名使用者

private sub command1_click()

dim 分數 as integer

分數 = 0

if val(text1.text) = 56 then 分數 = 分數 + 20

if val(text2.text) = 56 then 分數 = 分數 + 20

if val(text3.text) = 57 then 分數 = 分數 + 20

if val(text4.text) = 122 then 分數 = 分數 + 20

if val(text5.text) = 43 then 分數 = 分數 + 20

debug.print 分數

select case 分數

case is < 60

msgbox "不及格"

case is <= 70

msgbox "及格"

case is <= 80

msgbox "良"

case is <= 100

msgbox "優秀"

end select

end sub

private sub form_load()

label1.caption = "21+35=?"

label2.caption = "31+25=?"

label3.caption = "42+15=?"

label4.caption = "45+77=?"

label5.caption = "12+31=?"

end sub

2樓:匿名使用者

command1用來生成新題目,command2用來提交答案並計算成績,label1~5用來顯示題目,text1~5用來寫答案

public x0, x1, x2, x3, x4, x5, x6, x7, x8, x9 as single

private sub command1_click()

x0 = cint(rnd() * 10) * 10 + cint(rnd() * 10)

x1 = cint(rnd() * 10) * 10 + cint(rnd() * 10)

x2 = cint(rnd() * 10) * 10 + cint(rnd() * 10)

x3 = cint(rnd() * 10) * 10 + cint(rnd() * 10)

x4 = cint(rnd() * 10) * 10 + cint(rnd() * 10)

x5 = cint(rnd() * 10) * 10 + cint(rnd() * 10)

x6 = cint(rnd() * 10) * 10 + cint(rnd() * 10)

x7 = cint(rnd() * 10) * 10 + cint(rnd() * 10)

x8 = cint(rnd() * 10) * 10 + cint(rnd() * 10)

x9 = cint(rnd() * 10) * 10 + cint(rnd() * 10)

label1.caption = x0 & "+" & x1 & "="

label2.caption = x2 & "+" & x3 & "="

label3.caption = x4 & "+" & x5 & "="

label4.caption = x6 & "+" & x7 & "="

label5.caption = x8 & "+" & x9 & "="

end sub

private sub command2_click()

dim score as integer

score = 0

if val(text1.text) = x0 + x1 then score = score + 20

if val(text2.text) = x2 + x3 then score = score + 20

if val(text3.text) = x4 + x5 then score = score + 20

if val(text4.text) = x6 + x7 then score = score + 20

if val(text5.text) = x8 + x9 then score = score + 20

if score = 100 then msgbox "成績為優秀"

if score = 80 then msgbox "成績為良好"

if score = 60 then msgbox "成績為及格"

if score = 40 or score = 20 or score = 0 then msgbox "成績為不及格"

end sub

3樓:漆莊雅

90+80=

50+70=

40+90=

50+90=

80+30=

40分以下(含40分)不及格 60分及格 80分良 100分優

4樓:茅孟霜沈雅

吉林省2023年的電子設計大賽的《簡易算術控制器》中有這樣一部分。

5樓:

你這樣提問別人不好回答……

vb小學期怎麼迅速過

6樓:匿名使用者

背下基本概念和基本語法、基本控制元件的基本屬性、方法和事件。

如:常量、變數、變數型別、全域性變數、區域性變數、自定義變數,if...then...、select case、while..wend、do...loop、檔案處理。

文字框、標籤、按鈕、列表框等的基本屬性和方法和事件。

用vb設計一個1~10數的四則運算的算術題自動評分程式

7樓:匿名使用者

dim a, b, i, j, h as integer, c(1 to 4), d as string

private sub command1_click()

a = int(rnd * 11)

b = int((rnd * 10) + 1)

c(1) = "+": c(2) = "-": c(3) = "*": c(4) = "/"

j = int((rnd * 4) + 1)

d = c(j)

label1.caption = a & d & b & "=" & "?"

label1.refresh

command1.enabled = false

end sub

private sub command2_click()

i = i + 1

if d = c(1) then

if text1.text = a + b then

msgbox "恭喜你,計算正確"

h = h + 1

text1.text = ""

command1.enabled = true

label2.caption = "共" & i & "道題," & "答對" & h & "道題。"

label2.refresh

else

msgbox "真遺憾,計算錯誤"

text1.text = ""

command1.enabled = true

label2.caption = "共" & i & "道題," & "答對" & h & "道題。"

label2.refresh

end if

elseif d = c(2) then

if text1.text = a - b then

msgbox "恭喜你,計算正確"

h = h + 1

text1.text = ""

command1.enabled = true

label2.caption = "共" & i & "道題," & "答對" & h & "道題。"

label2.refresh

else

msgbox "真遺憾,計算錯誤"

text1.text = ""

command1.enabled = true

label2.caption = "共" & i & "道題," & "答對" & h & "道題。"

label2.refresh

end if

elseif d = c(3) then

if text1.text = a * b then

msgbox "恭喜你,計算正確"

h = h + 1

text1.text = ""

command1.enabled = true

label2.caption = "共" & i & "道題," & "答對" & h & "道題。"

label2.refresh

else

msgbox "真遺憾,計算錯誤"

text1.text = ""

command1.enabled = true

label2.caption = "共" & i & "道題," & "答對" & h & "道題。"

label2.refresh

end if

elseif d = c(4) then

if cdbl(text1.text) = a / b then

msgbox "恭喜你,計算正確"

h = h + 1

text1.text = ""

command1.enabled = true

label2.caption = "共" & i & "道題," & "答對" & h & "道題。"

label2.refresh

else

msgbox "真遺憾,計算錯誤"

text1.text = ""

command1.enabled = true

label2.caption = "共" & i & "道題," & "答對" & h & "道題。"

label2.refresh

end if

end if

end sub

8樓:匿名使用者

樓上的程式要再做修改一下。小學四則運算中的除法好像還不能出現除不盡的情況吧。9÷3=3可以。9÷4=2.25好像不行吧。。。

小學算術題

我買了一包牛奶糖大家平分兩粒兩粒的分剩下1粒,三粒三粒的分剩下2粒,五粒五粒的分剩下4粒,七粒七粒的分剩下6粒。這包牛奶糖 1顆就是2,3,5,7的公倍數2,3,5,7的最小公倍數 2 3 5 7 210所以這包糖最少有210 1 209顆 實際上,這包糖可以有209 210n顆 n為非負整數 解 ...

vb中計算這個算術題目的答案是多少,求大神解答

是5,對的 順序 6 7 8 5.25 然後整除 5 5.25 然後四捨六入五成雙.四舍 略 六入 略 五成雙 奇進偶不進 1.75 保留一位小數 1.8 1.65 保留一位小數 1.6 所以結果是1 1 mod 9 結果是1 1 4 5 vb中運算子的優先順序是 算術運算子 算術運算子 負號 算術...

VB設計登入程式,設計簡單的使用者登入程式

dim aaa as string private sub command1 click dim aa,bb aa admin 賬號 bb admin888 密碼 aaa val aaa 1 記錄登入次數if val aaa 3 then 等於大於3次,提示並退出程式 msgbox 你已經錯誤輸入三...