实验一PrivateSubCommand1_Click()Text2.FontSize=Text2.FontSize*2EndSubPrivateSubCommand2_Click()Text2.FontSize=Text2.FontSize/2EndSubPrivateSubCommand3_Click()IfText2.FontSize=Text2.FontSize*2ThenText2.FontSize=Text2.FontSize/2ElseIfText2.FontSize=Text2.FontSize/2ThenText2.FontSize=Text2.FontSize*2EndIfEndIfEndSubPrivateSubCommand4_Click()Text1.Text=EndSubPrivateSubForm_Click()IfText1=aAndText1=zThenText1=输入错误,请使用大写字母!ElseIfText1=AAndText1=ZThenText1=输入正确!EndIfEndIfEndSubPrivateSub清零_Click()EndSub实验二(1)PrivateSubCommand1_Click()Dima%,b%,c%,s%,c1%a=Val(Text1.Text)b=Val(Text2.Text)c=Val(Text3.Text)s=1/2*(a+b+c)c1=a+b+cText4.Text=c1Ifa=sOrb=sOrc=sThenText4.Text=不能构成三角形EndIfEndSubPrivateSubCommand2_Click()Dima%,b%,c%,s%,area&a=Val(Text1.Text)b=Val(Text2.Text)c=Val(Text3.Text)s=1/2*(a+b+c)area=Sqr(s*(s-a)*(s-b)*(s-c))Text4.Text=areaIfa=sOrb=sOrc=sThenText4.Text=不能构成三角形EndIfEndSub实验二(2)PrivateSubCommand1_Click()Dimr%,h%,v#,π!r=Val(Text1.Text)h=Val(Text2.Text)π=3.1416v=π*r^2*hText3.Text=vEndSubPrivateSubCommand2_Click()Dimr%,s!,π!r=Val(Text1.Text)π=3.1416s=4*π*rText3.Text=sEndSubPrivateSubCommand3_Click()Dima!,b!,h!,v#a=Val(Text4.Text)b=Val(Text5.Text)h=Val(Text6.Text)v=a*b*hText7.Text=vEndSub实验二(3)PrivateSubCommand1_Click()DimF!,C!F=Val(Text1.Text)C=5/9*(F-32)Text2.Text=CEndSub实验二(4)PrivateSubCommand1_Click()Dima!,b!,c!,x1!,x2!,k!a=Val(Text1.Text)b=Val(Text2.Text)c=Val(Text3.Text)k=b^2-4*a*cIfk=0ThenText4.Text=Text5.Text=-b/(2*a)ElseIfk0ThenText4.Text=(-b+Sqr(k)/(2*a))Text5.Text=(-b-Sqr(k)/(2*a))ElseIfk0ThenText4.Text=-b/(2*a)Text5.Text=Sqr(-k)/(2*a)EndIfEndSub实验三(1)PrivateSubCommand1_Click()Dimx!,y!x=Val(Text1.Text)y=Val(Text2.Text)Ifx1Theny=xElseIfx=1Andx10Theny=2*x-1Elsey=3*x-11EndIfEndIfText2=yEndSubPrivateSubCommand2_Click()Text1.Text=Text2.Text=Text1.SetFocusEndSub实验三(2)PrivateSubCommand1_Click()Dimgrade!grade=Text1.TextIfgrade=90ThenText2.Text=AElseIfgrade=80ThenText2.Text=BElseIfgrade=70ThenText2.Text=CElseIfgrade=60ThenText2.Text=DElseText2.Text=不及格EndIfEndSubPrivateSubCommand2_Click()Text1.Text=Text2.Text=EndSub实验三(3)PrivateSubCommand1_Click()Text1.Text=Text2.Text=EndSubPrivateSubLabel2_Click()Dimfact%,n%,i%n=Val(Text1.Text)fact=1Fori=1Tonfact=fact*iNextiText2.Text=factEndSub实验三(4)PrivateSubCommand1_Click()Dimi%,sum%sum=0Fori=0To100Step2sum=sum+iNextiText1.Text=sumEndSub实验三(5)PrivateSubCommand1_Click()Dimstr$,strTmp$,m%,n%,x%,y%,z%,w%x=0y=0z=0w=0str=Text1.Textn=Len(str)Form=1TonstrTmp=UCase(Mid(str,m,1))IfIsNumeric(strTmp)Thenx=x+1ElseIfAsc(strTmp)64AndAsc(strTmp)91Theny=y+1ElseIfstrTmp=Thenz=z+1Elsew=w+1EndIfNextmText2.Text=yText3.Text=zText4.Text=xText5.Text=wEndSub实验三(6)PrivateSubCommand1_Click()Dimm%,i%,k%,sum%,count%count=0sum=0Form=2To100k=Sqr(m+1)Fori=2TokIf(mModi)=0ThenExitForNextiIfi=k+1ThenPicture1.Printm;count=count+1If(countMod5)=0ThenPicture1.PrintEndIfsum=sum+mNextmPicture1.Printsum=;sumEndSub实验三(7)PrivateSubForm_Load()Fora=0To9Forb=0To9Forc=1To9Ifa^3+b^3+c^3=a+10*b+100*cThenMsgBox100*c+10*b+aEndIfNextcNextbNextaEndSub实验三(8)PrivateSubCommand1_Click()Dimi%,fact#,sum#sum=0fact=1Fori=1To20fact=fact*isum=sum+factNextiText1.Text=sumEndSub实验三(9)PrivateSubCommand1_Click()Dimsign%,i!,sum#,y#,trem#sign=1sum=1#Fori=3To20i=i+2sign=-1*signterm=sign/isum=sum+termIfterm=0.000001ThenExitForNextiy=4*sumText1.Text=yEndSub实验四(4)Dima(3,2)AsInteger,b(2,3)AsIntegerPrivateSubCommand1_Click()Picture1.Cls:Picture2.Cls:Picture3.ClsForn=1To3Form=1To2x=Int(Rnd*100):a(n,m)=Val(x)NextNextPicture1.CurrentY=80Forn=1To3Form=1To2Picture1.PrintFormat(a(n,m),@@@@);NextPicture1.PrintNextFork=1To2Forw=1To3x=Int(Rnd*100):b(k,w)=Val(x)NextNextPicture2.CurrentY=80Fork=1To2Forw=1To3Picture2.PrintFormat(b(k,w),@@@@);NextPicture2.PrintNextEndSubPrivateSubCommand2_Click()Dimc(3,2)AsIntegerFori=1To3Forj=1To2c(i,j)=a(i,j)*b(j,i)NextNextPicture3.ClsPicture3.CurrentY=200Forn=1To3Form=1To2Picture3.PrintFormat(c(n,m),@@@@@@);NextPicture3.PrintNextEndSub实验四(6)PrivateSubCommand1_Click()Dimi%,j%,s$(1To26),t$Fori=1To26s(i)=Chr(i+64)NextRandomizeFori=1To15j=Int(Rnd*(26-i+1)+i)t=s(i):s(i)=s(j):s(j)=tPrints(i);NextEndSub实验五(1)PublicSubmax(aAsInteger,bAsInteger,cAsInteger)DimtAsIntegerIfb=aAndc=aThent=aElseIfa=bAndc=bThent=bElseIfa=cAndb=cThent=cEndIfPicture1.Print;tEndSubPrivateSubCommand1_Click()DimaAsInteger,bAsInteger,cAsIntegera=Val(Text1.Text)b=Val(Text2.Text)c=Val(Text3.Text)Callmax(a,b,c)EndSub实验五(2)PrivateSubCommand1_Click()DimA(10)AsInteger,iAsInteger,MinAsIntegerFori=1To10A(i)=Int((101)*Rnd+300)NextiMin=A(1)Fori=2To10IfA(i)MinThenMin=A(i)NextiPrint最小值:&MinPrint数组:Fori=1To10PrintA(i);NextiPrintEndSub实验五(3)PrivateSubCommand1_Click()Dimn%,i%n=Val(InputBox(请输入数据n(0n30),Fibonacci数列))Fori=1TonPrintfibo(i),IfiMod5=0ThenPrintNextiEndSubPrivateFunctionfibo(x%)Ifx=1Orx=2Thenfibo=1Elsefibo=fibo(x-1)+fibo(x-2)EndIfEndFunction实验五(4)PrivateSubCommand1_Click()DimA(10)AsInteger,iAsInteger,MaxAsInteger,MinAsInteger,sAsInteger,AveAsIntegerFori=1To10A(i)=Int(101*Rnd)NextiMax=A(1):Min=A(1):s=A(1)Fori=2To10IfA(i)MaxThenMax=A(i)