您好,欢迎访问三七文档
当前位置:首页 > 电子/通信 > 综合/其它 > 郑州大学VB实验报告书-参考-答案
郑州大学VB实验报告书参考答案以下内容均来自百度文库,所以仅供参考。。不过经亲自测试习题及实验(一)的答案基本正确,除了实验题的3,4小题没有改字形字体颜色什么的。。实验一一、选择题DDBAB,C(CD)DDC,ADDCA二、填空题Windows中断工具箱代码分类form2.show有语法错误错误事件结构化文件名和结构工程编写代码双击任意控件或右健快捷菜单选“代码窗口”vb的安装文件夹属性方法fontload对象三、编程1-1PrivateSubCommand1_Click()PrintSqr(8),8^(1/3)EndSub1-2PrivateSubCommand2_Click()Fori=100To110PrintSqr(i)NextiEndSub1-3(基本设置在属性窗口完成!)PrivateSubCommand3_Click()Print郑州大学在前进!EndSub1-4(基本设置在属性窗口完成!)PrivateSubCommand4_Click()Label1=蓝天、白云、绿水、青山EndSub实验二一BCBCC,CBBDA,CCCBA,CBDCC二form_click()interval,5000vbp,frmtop,left,height,width,像素pictureloadlockedfont,alignmentgotfocus,lostfocus属性窗口,代码三2-1PrivateSubCommand1_Click()Label3=Text1*Text2EndSubPrivateSubCommand2_Click()Label3=Text1/Text2EndSub2-2PrivateSubCommand1_Click()Picture1.Visible=TruePicture1=LoadPicture(C:\DocumentsandSettings\AllUsers\Documents\MyPictures\示例图片\Waterlilies.jpg)EndSubPrivateSubCommand2_Click()Picture1.Visible=TruePicture1=LoadPicture(C:\DocumentsandSettings\AllUsers\Documents\MyPictures\示例图片\Winter.jpg)EndSubPrivateSubCommand3_Click()Picture1.Visible=FalseEndSub2-3PrivateSubCommand1_Click()Label3=Text1*Text2EndSub2-4PrivateSubCommand1_Click()Text2=Text1EndSubPrivateSubCommand2_Click()Text1=Text2=EndSubPrivateSubText1_Change()Command1.Visible=TrueCommand2.Visible=TrueEndSub2-5PrivateSubCommand1_Click()Timer1.Interval=500EndSubPrivateSubCommand2_Click()Timer1.Interval=0EndSubPrivateSubTimer1_Timer()Image1.Left=Int(Rnd*(Form1.ScaleWidth-Image1.Width))Image1.Top=Int(Rnd*(Form1.ScaleHeight-Image1.Height))EndSub实验三一A(BC)(BC)AA,A(BCD)DBB,B二3,4,5,6,8,10,11,12,14,15,16三abs(x+y)(3+x*y)^2(-b+sqr(b^2-4*a*c)/(2*a)sin(30*3.14/180)+exp(2)四int(rnd*71+20)x*y0xmod3=0orxmod7=0x=10andx20x=Aandx=Zleft(s,3)或者,mid(s,1,3)五3-2PrivateSubCommand1_Click()DimxAsSinglex=Val(Text1)PrintFormat(x^2,##.000),Format(Sqr(x),##.000),Format(x^3,##.000),Format(x^(1/3),##.000)EndSub3-3PrivateSubCommand1_Click()DimxAsIntegerx=Int(Rnd*900+100)Text1=Trim(Str(x))Text2=Right(Text1,1)+Mid(Text1,2,1)+Left(Text1,1)EndSub3-4PrivateSubCommand1_Click()Dimmax,minAsIntegermin=Val(Text1)max=Val(Text2)RandomizePrintInt(Rnd*(max-min+1)+min),Int(Rnd*(max-min+1)+min),Int(Rnd*(max-min+1)+min)EndSub3-5PrivateSubCommand1_Click()Text1=DateText2=TimeText3=WeekdayName(Weekday(Date))EndSub实验四一CDCDA,DBBAC二(1)48.71E-01,-4.8712(2)关系,逻辑,数值(3)900,100,mid(a,2,1),c(4)m1,2,3printm&月是第二季度endselect三(1)x=4y=13(2)10四4-1PrivateSubCommand1_Click()Dimnum,a1,a2,a3AsSinglenum=Val(Text1)*180/3.14a1=Int(num)num=num-a1a2=Int(num*60)num=num*60-a2a3=Format(num*60,##.000)Printa1,a2,a3EndSub4-2PrivateSubCommand1_Click()DimyAsIntegery=Val(Text1)If(yMod400=0OryMod4=0AndyMod1000)ThenMsgBoxy&是闰年ElseMsgBoxy&不是闰年EndIfEndSub4-3PrivateSubCommand1_Click()Dimx,y,z,tAsIntegerx=Val(InputBox(inputx:))y=Val(InputBox(inputy:))z=Val(InputBox(inputz:))IfxyThent=x:x=y:y=tIfyzThent=y:y=z:z=tIfxyThent=x:x=y:y=tEndIfPrintx,y,zEndSub4-4PrivateSubCommand1_Click()DimnettimeAsInteger,moneyAsSinglenettime=Val(InputBox(每月上网时数:,上网费用))Ifnettime=-1Thenmoney=0ElseIfnettime10Thenmoney=25ElseIfnettime50Thenmoney=nettime*2ElseIfnettime100Thenmoney=nettime*1.5ElseIfnettime200Thenmoney=nettimeElsemoney=200EndIfIfmoney0ThenMsgBox该月上网费用为&money&元实验五一BCBAC二(1)forx=1to10s*(1-1/x)(2)0t1E-6(3)jt(4)5115三5-1PrivateSubCommand1_Click()Dimi,sumAsIntegersum=0Fori=1To100sum=sum+iNextiPrint1+2+...+100=;sumEndSub5-2PrivateSubCommand1_Click()Dimx,yAsIntegerForx=0To20Fory=0To33If5*x+3*y+(100-x-y)/3=100ThenPrintx,y,100-x-yEndIfNextyNextxEndSub5-3PrivateSubCommand1_Click()DimiAsIntegeri=7DoIfiMod2=1AndiMod3=2AndiMod5=4AndiMod6=5AndiMod7=0ThenPrintiExitDoElsei=i+7EndIfLoopEndSub5-4PrivateSubCommand1_Click()Dimx,y,zAsIntegerForx=1To9Fory=1To9Forz=0To9If100*x+10*x+z+100*y+10*z+z=532ThenPrintx,y,zEndIfNextzNextyNextxEndSub5-5PrivateSubCommand1_Click()DimsumAsSingle,nAsIntegersum=1DoWhilesum=4sum=sum*1.1n=n+1LoopPrint经过;n;年销售收入翻两番EndSub5-6PrivateSubCommand1_Click()Dimsum,i,nAsIntegersum=0n=Val(InputBox(请输入n的值:))Fori=1Tonsum=sum+i*(-1)^(i+1)NextiPrint1-2+3-4+...=;sumEndSub5-7PrivateSubCommand1_Click()Dimsum,isum,i,nAsIntegersum=0isum=0n=Val(InputBox(请输入n的值:))Fori=1Tonisum=isum+isum=sum+isumNextiPrint1+(1+2)+(1+2+3)+...=;sumEndSub5-8PrivateSubCommand1_Click()Dimpi,tiAsSingleDimiAsIntegerpi=0ti=1i=1DoWhileAbs(ti)=0.0001ti=(-1)^(i+1)/(2*i-1)pi=pi+tii=i+1LoopEndSub5-9PrivateSubCommand1_Click()Dimi,j,kAsIntegerPrint水仙花数有:Fori=1To9Forj=0To9Fork=0To9Ifi*100+j*10+k=i^3+j^3+k^3ThenPrinti,j,kEndIfNextkNextjNextiEndSub5-10PrivateSubCommand1_Click()Dimi,j,kAsIntegerk=0Fori=999To100Step-1Forj=2ToInt(Sqr(i))IfiModj=0ThenExitForNextjIfj=Int(Sqr(i))+1Thenk=k+1:PrintiIfk=3ThenExitForNextiEndSub5-11PrivateSubCommand1_Click()Dimi,n,min,maxAsIntegerDimaverAsSinglemin=100max=50Fori=1To20n=Int(Rnd*(99-51)+51)Printn;IfiMod5=0ThenPrintIfnmaxThenmax=nIfnminThenmin=naver=aver+nNextiPrintmax=;maxPrintmin=;minPrintaverage=;aver/20EndSub5-12PrivateSubCommand12_Click()Dimi,jAsIntegerFori=1To5Forj=1To(2*i-1)PrintTab(20-i+j);*;NextjNextiEndSub实验六一BCCCDDDDCA二、6-1OptionBase1PrivateSubCommand1_
本文标题:郑州大学VB实验报告书-参考-答案
链接地址:https://www.777doc.com/doc-5552581 .html