VB随机产生50个"0-9"之间的数,统计它们的个数
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/11 05:59:32
窗体中加命令按钮,单击事件代码如下:PrivateSubCommand1_Click() Randomize Dima(1To20)AsInteger&nb
PrivateSubForm_Load()Dima(10),i,x,jAsIntegerDimyAsStringFori=0To9Randomizea(i)=Int(Rnd(1)*101)x=x+a(
PrivateSubCommand1_Click()Dima(50),i,nRandomizeFori=1To50a(i)=Int(Rnd*191)+10Printa(i);IfiMod10=0The
PrivateSubCommand1_Click()RandomizeDima(10)AsInteger,imasasinteger,iminasinteger,Averageasintegerima
PrivateSubCommand1_Click()Dimi,max,min,sAsIntegermax=0min=100s=0Dima(30)AsIntegerText1.Text=""Text2.
PrivateSubForm_Click()Dima(19)AsIntegerDimmaxAsInteger,minAsInteger,avAsIntegerFori=0To19a(i)=Int((1
先在窗体上添加一个TextBox文本框(将其Multiline属性设置为True,并调整宽高以便能较好的显示出100个随机数)和一个Button按钮.然后双击Button按钮跳转到代码编辑窗口,粘帖以
帮你写好了,这个是工程文件,下载下来就可以了.以下是源码:PrivateSubCommand1_Click()DimA(10)AsDouble,LAsInteger,BAsDouble,CAsDoub
PrivateSubCommand1_Click()DimIAsInteger,NAsInteger,MaxAsInteger,MinAsIntegerMin=100RandomizeForI=1To
我已经上机验证过了,正确.思路:产生80个随机数,把这80个随机数由小到大排序,然后从第1个到第80个的顺序挑选偶数,赋值给字符串s1,够10个换行.再从第80个到第1个的顺序挑选奇数,赋值给字符串s
PrivateSubCommand1_Click()DimiAsInteger,nAsInteger,mAsIntegerFori=1To50n=Int(1+Rnd*100)IfnPrintn;m=m
Dimm(99)AsInteger,n(9)AsInteger,iAsInteger,kAsIntegerRandomizeFori=0To99m(i)=Int(Rnd*100)Printm(i);k
Dimy%,x%Fori=1To10x=Int(Rnd*100)'[0,99]Printx;Ifi=1Theny=xElseIfy>xTheny=xEndIfNextiPrint"最小值";x如果是N
再问:谢了,能否把程序给提供一下,我不会再答:好吧!
dima(9)asintegerprivatesubcommand1_click()dimiasintegerrandomizefori=0to9a(i)=int(rnd*101)text1.text
是的!
PrivateSubCommand1_Click()DimArr(9)AsLong'用于存放产生的10随机数DimiAsLongDimnMaxAsLong'用于存放最大的偶数DimnMinAsLong
窗体上放个CommandButton和两个Label:PrivateSubCommand1_Click()DimiAsInteger,jAsInteger,nAsIntegerLabel1.Capti
PrivateSubCommand1_Click()DimZs(1To35)AsIntegerFori=1To35RandomizeZs(i)=Int(61*Rnd)+20PrintZs(i);Nex
Randomizea=int(rnd*6)+50