欢迎来到天天文库
浏览记录
ID:38720007
大小:108.00 KB
页数:18页
时间:2019-06-18
《计算机二级VB上机操作题i》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、计算机二级VB上机操作题1、屏保PrivateSubForm_DblClick()EndEndSubPrivateSubTimer1_Timer()Print"*"Form1.CurrentX=Rnd*Form1.WidthForm1.CurrentY=Rnd*Form1.HeightForm1.ForeColor=RGB(255*Rnd,255*Rnd,255*Rnd)Form1.FontSize=Rnd*60EndSub2、抽奖PrivateSubCommand1_Click()Timer1.Enabled=TrueEndSubPrivat
2、eSubCommand2_Click()Timer1.Enabled=FalseEndSubPrivateSubLabel1_Click()Label1.Caption="今天是"&Year(Now)&"年"&Month(Now)&"月"&WeekdayName(Weekday(Now))EndSubPrivateSubTimer1_Timer()Text1.Text=Int(Rnd*10)Text2.Text=Int(Rnd*10)Text3.Text=Int(Rnd*10)Text4.Text=Int(Rnd*10)Text5.Text=I
3、nt(Rnd*10)Text6.Text=Int(Rnd*10)Text7.Text=Int(Rnd*10)EndSub3、将第一个字母换成大写,其余小写PrivateSubForm_Click()18DimxAsStrings="miDEFSDVFGS"PrintUCase(Mid(s,1,1))&LCase(Mid(s,2,Len(s)-1))EndSub4、求SIN?=?PrivateSubForm_Click()DimxAsIntegerx=Text1.TextText2.Text=Sin(x*3.1415926/180)EndSub5
4、、09年(春)上机05OptionExplicitOptionBase1PrivateSubCommand1_Click()DimkAsInteger,nAsInteger,num()AsInteger,iAsIntegerDon=Int(Rnd*900)+100Ifvalidate(n)Thenk=k+1ReDimPreservenum(k)num(k)=nEndIfLoopUntilk>=12Fori=1ToUBound(num)IfiMod4<>0ThenText1=Text1&Str(num(i))ElseText1=Text1&Str
5、(num(i))&vbCrLfEndIfNextiEndSubPrivateFunctionvalidate(ByValnAsInteger)AsBooleanDimp(3)AsInteger,iAsInteger,jAsInteger,kAsIntegerDoi=i+1p(i)=nMod10n=n10LoopUntiln<=0Fori=1ToUBound(p)-1Forj=i+1ToUBound(p)Ifp(i)=p(j)Thenk=k+1Nextj18NextiIfk=1Thenvalidate=TrueEndFunction6、答题Di
6、mresultAsIntegerDimrightqAsIntegerDimwrongqAsIntegerPrivateSubCommand1_Click()DimaAsIntegerDimbAsIntegerDimfAsIntegera=Int(Rnd*10)b=Int(Rnd*10)f=Int(Rnd*4)+1SelectCasefCase1Label1.Caption="a"&"+"&"b"&"="result=a+bLabel1.Caption="a"&"-"&"b"&"="result=a-bLabel1.Caption="a"&"x"
7、&"b"&"="result=a*bLabel1.Caption="a"&"÷"&"b"&"="result=a/bEndSelectEndSubPrivateSubCommand3_Click()IfVal(Text2.Text)=resultThenText1.Text=Label1.Caption&Text2.Text&"√"&vbCrLfrightq=rightq+1Elsewrongq=wrongq+1Text1.Text=Text1.Text&Label1.Caption&Text2.Text&"×"&Chr(13)+Chr(10)
8、EndIfText4.Text=rightqText8.Text=wrongqText7.Text=rightq+wrongqText6.Text=F
此文档下载收益归作者所有