欢迎来到天天文库
浏览记录
ID:59548087
大小:40.00 KB
页数:26页
时间:2020-11-10
《Visual-Basic-实验指导书程序代码.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、9-1OptionExplicitOptionBase1PrivateSubCommand1_Click(Dimx(10AsInteger,maxvAsInteger,minvAsIntegerDimiAsIntegerFori=1To10x(i=Int(90*Rnd+10Text1.Text=Text1&Str(x(iNextiCallmaxmin(x,maxv,minvText2.Text=maxvText3.Text=minvEndSubPrivateSubCommand2_Click(Text1.Text=""Text2.
2、Text=""Text3.Text=""EndSubPrivateSubCommand3_Click(EndEndSubPrivateSubmaxmin(a(AsInteger,maxAsInteger,minAsIntegerDimiAsIntegermax=a(1:min=a(1Fori=LBound(a+1ToUBound(aIfa(i>maxThenmax=a(iElseIfa(i3、al(Text1.TextIfverify(xThenList1.AddItemxElseMsgBoxStr(x&"不是自守数。",vbInformationEndIfEndSubPrivateSubCommand2_Click(Text1.Text=""EndSubPrivateSubCommand3_Click(EndEndSubPrivateFunctionverify(xAsLongAsBooleanDimyAsLong,sAsIntegerverify=Falses=Len(CStr(xy=x*xIfx=Val(Righ4、t(CStr(y,sThenverify=TrueEndIfEndFunction9-3OptionExplicitOptionBase1PrivateSubCommand1_Click(DimaAsInteger,bAsInteger,iAsIntegera=Val(Text1.Text:b=Val(Text2.TextFori=aTobIfsx(i=TrueThenList1.AddItemi8EndIfNextiIfList1.ListCount=0ThenList1.AddItem"无升序数"EndSubPrivateSu5、bCommand2_Click(Text1.Text=""Text2.Text=""List1.ClearText1.SetFocusEndSubPrivateSubCommand3_Click(EndEndSubPrivateFunctionsx(ByValnAsIntegerAsBooleanDima(AsInteger,kAsInteger,iAsIntegerDok=k+1ReDimPreservea(ka(k=nMod10n=n10LoopUntiln<=0Fori=1ToUBound(a-1Ifa(i+1>=a(iT6、henExitFunctionNextisx=TrueEndFunction9-4OptionExplicitPrivateSubCommand1_Click(Text1.Text=""Text2.Text=""Text3.Text=""EndSubPrivateSubCommand2_Click(EndEndSubPrivateFunctioncommon(ByValaAsInteger,ByValbAsIntegerAsIntegerDimrAsIntegerDor=aModba=bb=rLoopWhiler<>0common7、=aEndFunctionPrivateSubOption1_Click(IndexAsIntegerDimaAsInteger,bAsIntegerDimmAsInteger,dAsIntegera=Text1b=Text2m=common(a,bIfIndex=0ThenText3=mElsed=a*b/mText3=dEndIfEndSub9-5OptionExplicitPrivateFunctionJudge(nAsIntegerAsBooleanDimiAsIntegerFori=2ToSqr(nIfnModi=0Th8、enExitFunctionNextiJudge=TrueEndFunctionPrivateSubCommand1_Click(DimxAsInteger,iAsIntegerx=Text1.TextIfx=4ThenText2="2+2"Els
3、al(Text1.TextIfverify(xThenList1.AddItemxElseMsgBoxStr(x&"不是自守数。",vbInformationEndIfEndSubPrivateSubCommand2_Click(Text1.Text=""EndSubPrivateSubCommand3_Click(EndEndSubPrivateFunctionverify(xAsLongAsBooleanDimyAsLong,sAsIntegerverify=Falses=Len(CStr(xy=x*xIfx=Val(Righ
4、t(CStr(y,sThenverify=TrueEndIfEndFunction9-3OptionExplicitOptionBase1PrivateSubCommand1_Click(DimaAsInteger,bAsInteger,iAsIntegera=Val(Text1.Text:b=Val(Text2.TextFori=aTobIfsx(i=TrueThenList1.AddItemi8EndIfNextiIfList1.ListCount=0ThenList1.AddItem"无升序数"EndSubPrivateSu
5、bCommand2_Click(Text1.Text=""Text2.Text=""List1.ClearText1.SetFocusEndSubPrivateSubCommand3_Click(EndEndSubPrivateFunctionsx(ByValnAsIntegerAsBooleanDima(AsInteger,kAsInteger,iAsIntegerDok=k+1ReDimPreservea(ka(k=nMod10n=n10LoopUntiln<=0Fori=1ToUBound(a-1Ifa(i+1>=a(iT
6、henExitFunctionNextisx=TrueEndFunction9-4OptionExplicitPrivateSubCommand1_Click(Text1.Text=""Text2.Text=""Text3.Text=""EndSubPrivateSubCommand2_Click(EndEndSubPrivateFunctioncommon(ByValaAsInteger,ByValbAsIntegerAsIntegerDimrAsIntegerDor=aModba=bb=rLoopWhiler<>0common
7、=aEndFunctionPrivateSubOption1_Click(IndexAsIntegerDimaAsInteger,bAsIntegerDimmAsInteger,dAsIntegera=Text1b=Text2m=common(a,bIfIndex=0ThenText3=mElsed=a*b/mText3=dEndIfEndSub9-5OptionExplicitPrivateFunctionJudge(nAsIntegerAsBooleanDimiAsIntegerFori=2ToSqr(nIfnModi=0Th
8、enExitFunctionNextiJudge=TrueEndFunctionPrivateSubCommand1_Click(DimxAsInteger,iAsIntegerx=Text1.TextIfx=4ThenText2="2+2"Els
此文档下载收益归作者所有