vb 生产10个元素的随机数组
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/06 04:05:49
#include#includevoidmain(){\x05inti,j;\x05floatsuma,sumb;\x05floatavga,avgb;\x05intmaxa,maxb;\x05int
窗体中加命令按钮,单击事件代码如下:PrivateSubCommand1_Click() Randomize Dima(1To20)AsInteger&nb
OptionBase1OptionExplicitDima(11)AsIntegerPrivateSubCommand1_Click()DimiAsIntegerPicture1.ClsPicture
dima(10)asintegerdimiasinteger,kasinteger,pasintegerdimmasintegerdimnasintegerfori=1to10a(i)=int(rnd
PrivateSubForm_Load()Dima(10),i,x,jAsIntegerDimyAsStringFori=0To9Randomizea(i)=Int(Rnd(1)*101)x=x+a(
PrivateSubCommand1_Click()RandomizeDima(10)AsInteger,imasasinteger,iminasinteger,Averageasintegerima
OptionExplicitPrivatea(9)AsIntegerPrivateiMaxIndexAsIntegerPrivateSubCommand1_Click()Dimi,j,k,iMaxAs
PrivateSubCommand1_Click()RandomizeDima(1To10)Dimmax,min,avemin=50:max=20Fori=1To10a(i)=Int(Rnd*21+3
#include#include#includeintmain(){srand((unsigned)time(0));intArray[10];inti=0;doublesum=0;intMax=-1
PrivateSubCommand1_Click()Dima(10)RandomizeDimsumAsInteger,minAsInteger,maxAsIntegersum=0:min=100:ma
Dima(10)Fori=0To9a(i)=Int(100+100*Rnd)NextiFori=0To8Forj=iTo9Ifa(i)t=a(i)a(i)=a(j)a(j)=tEndIfNextjNe
PrivateSubCommand1_Click()Dima(1To10)AsIntegerRandomizeFori=1To10a(i)=Int(Rnd*100)+1Printa(i);NextPr
Dimm(99)AsInteger,n(9)AsInteger,iAsInteger,kAsIntegerRandomizeFori=0To99m(i)=Int(Rnd*100)Printm(i);k
一下代码!你参考一下!PrivateSubCommand1_Click()ClsDima()AsInteger'定义一个动态数组Dimb(10)AsInteger'用于统计Randomizen=4:m
'vb6测试成功OptionExplicitPrivateFunctionmax(b()AsInteger)AsIntegerDimiAsIntegerDimjAsIntegerFori=1To6Fo
第一题:Optionbase1PrivateSubForm_Click()Dima(4,5)asinteger,iasinteger,jasinteger,sasintegerdima_aveassi
#include#include#includeintmain(){inti,a[10],m,t=0,s=0;floatn;srand((unsigned)time(NULL));for(i=0;i
#include#include#includeintmain(){inti,a[10],m,t=0,s=0;floatn;srand((unsigned)time(NULL));for(i=0;i
#include#includevoidmain(){inta[10];inti,j,temp;cout
PrivateSubCommand1_Click()Dima(1To20)Fori=1To20a(i)=Val(InputBox("请你输入第"&i&"个数"))NextiPrint"交换前的数为"F