VB编程题生成随机整数显示奇数
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/12 02:38:25
窗体中做三个文本框,分别放A,B,及A、B的最大分约数.PrivateSubCommand1_Click()a=Val(Text1.Text)b=Val(Text2.Text)Dor=aModba=b
是不是这样:(fomr的autodraw属性要设定为true)PrivateSubCommand1_Click()DimiAsIntegerDimRndNUmAsInteger'定义随机数DimN1A
'本人亲测可行Private Sub Form_CLICK() Dim arr(9) As In
第一题dims(1to8)asintegerfori=1to4s(i)=int(rnd*90)+10dowhiles(i)mod2=1s(i)=int(rnd*90)+10loops(i+4)=int
privatesubform_click()dima(2,2),b(2,2),c(2,2),i,jrandomizefori=0to2forj=0to2a(i,j)=int(rnd*10)pictur
以下代码为输入任意多个数字进行统计如果输入0则退出循环显示出统计结果PrivateSubCommand1_Click()DimiAsIntegerDimqAsIntegerDimoAsIntegerq
Dimk%Dima%(1To10)PrivateSubCommand1_Click()Fori=1To10Randomizea(i)=Int(Rnd*100+1)NextPrint"a数组:"k=1F
PrivateSubCommand1_Click()DimiAsInteger,nAsInteger,mAsIntegerFori=1To50n=Int(1+Rnd*100)IfnPrintn;m=m
Private Sub Command1_Click() Dim i As Integer, n As&nb
privatesubcommand1_click()dima(10)fori=1to10a(i)=int(rnd*90)+10printa(i);s=s+a(i)nextprintprint"总和="
生成按钮代码:PrivateSubCommand1_Click()RandomizeFori=1To100t=Int(Rnd()*900+100)IftMod2=0ThenList1.AddItemt
'窗体放一个按钮Command1PrivateSubCommand1_Click()Randomize'初始化随机数生成器DimJiShuHangAsString'奇数行DimOuShuHangAsS
再问:谢了,能否把程序给提供一下,我不会再答:好吧!
先建一个大一点的label1框,然后...DimaAsIntegerDimbAsStringDimcAsIntegerDimdAsStringDimeAsIntegerDimfAsIntegerDim
Dima(5)AsDoublefori=1to5a(i)=fix(rnd*10)nextiFori=1To4Forj=1To5-iIfa(j)temp=a(j)a(j)=a(j+1)a(j+1)=te
PrivateSubCommand1_Click()Fork=1To20Step1Print"K=";k;t=Rnd()t=Rnd()*100t=Int(t)Printt,IfInt(t/2)=t/2
添加两个控件名字分别为sc、tj的按钮.'定义一个窗体数组变量dima(10)asinteger'生成是个随机数privatesubsc_click()'下面这一句可以得到不同的随机数randomiz
Private Sub Command1_Click() Cls Dim r(
PrivateSubCommand1_Click()DimArr(9)AsLong'用于存放产生的10随机数DimiAsLongDimnMaxAsLong'用于存放最大的偶数DimnMinAsLong
写成函数,直接调用Functionprint_num(ByValnumAsInteger)Dimi,n,k,jAsIntegerDimstrAsStringn=Int(num/2)k=0IfnumMo