用vb.net编写程序 修改和界面设计
列如:30=2*3*5
要求:各个质因子从小到大排列
6.加法练习:编写一个程序,能够随机出100以内的加法题共练习用,
要求:每显示一道题后,答题者输入答案,按下提交按钮后,显示正确与否的信息,无论正确与否,均进行下一题,按结果按钮结束,同时显示的信息还有本次测试共答对几题
5
idata=10000
dim arrey_yin(idata)as integer
dim yin_index as integer=0
dim b_yin as boonlean
for i as integer=2 to 10000
b_yin=false
for j as integer=2 to i-1
if i mod j=0 then
b_yin=true
exit for
end if
next
if b_yin=false then
arrey_yin(yin_index)=i
yin_index+=1
end if
next
dim yin_arr() as integer
dim yinarr_index as integer=0
dim h as integer=0
for i as integer=0 to yin_index-2
h=0
for i as integer=0 to yin_index-2
if idata mod array_yin(i)=0 then
yin_arr(yinarr_index)=arrey_yin(i)
yinarr_index+=1
idata=idata\array_yin(i)
exit for
end if
next
if idata=1 then
exit for
end if
next
dim data1.data2 as single
data1=cint(rnd()*100)
data2=cint(rnd()*100)
dim iright,ierror as integer
dim sum_data as single=data1+data2
if sum_data=cint(textbox1)then
iright+=1
else
ierror+=1
end if
6 展开
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim aa As Integer = Val(TextBox1.Text)
Dim i As Integer
For i = 2 To aa
If aa Mod i = 0 Then
TextBox2.Text += i.ToString + " "
aa = aa / i
i = 2
End If
Next
End Sub
Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TextBox1.Text = ss()
TextBox2.Text = ss()
End Sub
Function ss()
Randomize()
Dim a As Integer = Int(Rnd() * 100)
Return a
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Val(TextBox1.Text) + Val(TextBox2.Text) = Val(TextBox3.Text) Then
i += 1
Label3.Text = "正确"
Else
j += 1
Label3.Text = "错误"
End If
aa += 1
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
TextBox1.Text = ss()
TextBox2.Text = ss()
TextBox3.Text = ""
Label3.Text = ""
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
TextBox4.Text = "你已经答了" + aa.ToString + "题,答对" + i.ToString + "题," + "答错" + j.ToString + "题。"
End Sub