用vb.net编写程序 修改和界面设计

[复制链接]
查看11 | 回复1 | 2010-6-23 17:47:09 | 显示全部楼层 |阅读模式
5任给一个10000内的合数,求他的因式分解
列如: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

回复

使用道具 举报

千问 | 2010-6-23 17:47:09 | 显示全部楼层
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
TextBox
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行