vb编程~~~拜托了!!!
来源:百度知道 编辑:UC知道 时间:2024/06/15 01:36:03
1 随机产生50个10-90之间的整数,选出其中的素数,并按由小到大的顺序输出。
declare sub getrnd(a() as integer,b() as integer)
declare sub mysort(x() as integer,n as integer)
declare sub outarr(x() as integer,n as integer)
call getrnd(a())
call mysort(a(),n)
print call outarr(a(),n)
end
sub getrnd(a() as integer,b() as integer)
dim y as integer
for i=1 to 50
randomize
a(i)=int(81*rnd)+10
for j=2 to sqr(a(i)
if a(i) mod j<>0 then
y=y+1: b(y)=a(i)
next j
next i
end sub
sub mysort(x() as integer,n as integer)
dim j as integer,i as integer
for j=1 to n-1
for i=1 to n-j
if x(i)>x(i+1) then swap x(i),x(i+1)
next i
next j
end sub
sub outarr(x() as integer,n as integer)
for i=1 to y
print x(i);
if (i mod 10=0) then print
next i
print
end sub
题目跟你差不多 具体自己做吧 悬赏分0分没动力做