2.用随机函数产生50个二位数,找出其中最大的数.
来源:学生作业帮助网 编辑:作业帮 时间:2024/08/30 09:39:31
窗体中加命令按钮,单击事件代码如下:PrivateSubCommand1_Click() Randomize Dima(1To20)AsInteger&nb
PrivateSubCommand1_Click()RandomizeDima(10)AsInteger,imasasinteger,iminasinteger,Averageasintegerima
command1完成第一题,command2完成第二题PrivateSubCommand1_Click()Dimx%(1To10),n%,i%n=1DoWhilen
PrivateSubCommand1_Click()Dimi,max,min,sAsIntegermax=0min=100s=0Dima(30)AsIntegerText1.Text=""Text2.
zd=Int(Rnd()*51)+50zx=Int(Rnd()*51)+50Fori=1To19xd=Int(Rnd()*51)+50Ifxd>zdThenzd=xdIfxdNextiPrintzd,
dima,max,min,sum,averagesum=0max=20min=50fori=1to20a=(Rnd*50)+50sum=sum+aifamaxthenmax=aprintanextpr
s=0p=50q=100Fori=1To20a=Int(Rnd*51+50)Printa;ifa>=pthenp=aendififa
PrivateSubCommand1_Click()Dima%(1To20),max%,min%max=50min=100RandomizeClsFori=1To20a(i)=Int(Rnd*51+5
Dima(1To20)AsIntegerPrivateSubCommand1_Click()ClsScale(0,0)-(100,100)Foru=1To20a(u)=Int(Rnd*50)+50b=
PrivateSubForm_Click()Dima(19)AsIntegerDimmaxAsInteger,minAsInteger,avAsIntegerFori=0To19a(i)=Int((1
PrivateSubCommand1_Click()DimIAsInteger,NAsInteger,MaxAsInteger,MinAsIntegerMin=100RandomizeForI=1To
Dima(10)Fori=0To9a(i)=Int(100+100*Rnd)NextiFori=0To8Forj=iTo9Ifa(i)t=a(i)a(i)=a(j)a(j)=tEndIfNextjNe
我已经上机验证过了,正确.思路:产生80个随机数,把这80个随机数由小到大排序,然后从第1个到第80个的顺序挑选偶数,赋值给字符串s1,够10个换行.再从第80个到第1个的顺序挑选奇数,赋值给字符串s
#includevoidmain(){inta[100],i;for(i=0;i
Dimm(99)AsInteger,n(9)AsInteger,iAsInteger,kAsIntegerRandomizeFori=0To99m(i)=Int(Rnd*100)Printm(i);k
按你的要求,修改了,代码如下,#include#include#include#defineN10000intmain(){inta[10],i,n;srand(time(0));//srand((u
#include#include#includeintmain(void){srand(time(0));inti=0;//用于下面的循环inta[20]={0};//用于存储产生的20个随机数.do
这个程序不难,不知你要统计什么呢?
dima(30)fori=1to30a(i)=int(rnd(97+3))ifisprime(a(i))=truethenprinta(i);nextifunctionisprime(xasinteg
窗体上放个CommandButton和两个Label:PrivateSubCommand1_Click()DimiAsInteger,jAsInteger,nAsIntegerLabel1.Capti