'对文本框中输入的大写英文明文,一一转换成小写密文。PrivateSubCommand1_Click()DimxAsString,yAsStringDimiAsIntegerDimtemp1AsString,temp2AsStringx=Text1.Texty=Fori=1ToLen(Text1.Text)'①LenLen(X)temp1=Mid(x,i,1)temp2=Chr(Asc(temp1)+32)'②Chr(Asc(temp1)+32)y=y+temp2NextiText2.Text=y'③yEndSub'用穷举法,找出所有的水仙花数。所谓“水仙花数”是指一个三位数,其各位数字立方和等于该数本身'例如:153是一个“水仙花数”,因为153=1^3+5^3+3^3。PrivateSubCommand1_Click()DimiAsInteger,aAsInteger,bAsInteger,cAsIntegerFori=100To999a=i\100'①100b=(i-a*100)\10'②100c=iMod10Ifa^3+b^3+c^3=iThenPrintiNexti'③NextiEndSub'通过键盘依次输入任意10个数字,然后将其按先输入后输出的反方向显示。PrivateSubCommand1_Click()Dims(9)AsSingleFori=0To9s(i)=Val(InputBox(请输入一个数))'①s(i)NextiFori=9To0Step-1'②-1Prints(i)'③s(i)NextiEndSub'在文本框输入a,b,c,然后求出最大值,显示在label3里PrivateSubCommand1_Click()Dima,b,c,maxAsIntegera=Val(Text1.Text)b=Val(Text2.Text)c=Val(Text3.Text)IfabThenmax=aElsemax=b'①max=bIfcmaxThenmax=c'②max=cLabel3.Caption=CStr(max)'③maxEndSub'输出图形'*****'*****'*****'*****PrivateSubCommand1_Click()Dimi,jAsIntegerFori=1To4'①4PrintTab(5-i);Forj=1To5'②5Print*;'③*;NextjPrintNextiEndSub'当按下上移按钮,标签移动到和上移按钮等高位置,当按下下移按钮,标签移动到和下移按钮等高的位置PrivateSubCommand1_Click()Label1.Top=Command1.Top'①Label1.Top=Command1.TopEndSubPrivateSubCommand2_Click()Label1.Top=Command2.Top'②Label1.Top=Command2.TopEndSub'题目:输入一个3位数,将其反过来输出,如输入“123”,则输出321PrivateSubCommand1_Click()DimaAsInteger,bAsIntegerDimbaiAsInteger,shiAsIntegerDimgAsIntegera=Val(Text1.Text)'①Text1.Textbai=a\100shi=(a-bai*100)\10g=aMod10'(a-bai*100)mod10a-bai*100-shi*10b=g*100+shi*10+bai'②bText2.Text=CStr(b)'③Text2.TextEndSub'题目:将一张100元的钞票换成100张由5元,1元,5角的所有组合要求每一种币都要有PrivateSubCommand1_Click()DimWuyuanAsIntegerDimYiyuanAsIntegerDimWujiaoAsIntegerForWuyuan=1To20ForYiyuan=1To100'①100Wujiao=100-Wuyuan-Yiyuan'②YiyuanIfWuyuan*5+Yiyuan*1+Wujiao*0.5=100ThenPrintWuyuan=&Wuyuan&,Yiyuan=&Yiyuan&,Wujiao=&WujiaoEndIf'③endifNextYiyuanNextWuyuanEndSub'求斐波那契数列的20项的值。该数列的第一项和第二项都是1,从第三项起,后一项是前两项的和。PublicFunctionFib(nAsInteger)AsIntegerIf(n=1)Or(n=2)ThenFib=1'①1ElseFib=Fib(n-1)+Fib(n-2)EndIf'②EndIfEndFunctionPrivateSubCommand1_Click()DimSAsIntegerS=Fib(20)'③PrintS=&CStr(S)EndSub'找出所有三位数的水仙花数PrivateSubCommand1_Click()Dimi,a,bAsIntegerFori=100To999'①a=i\100b=(i-a*100)\10c=iMod10'②imod10或(i-a*100)mod10或i-a*100-b*10Ifa*a*a+b*b*b+c*c*c=iThenPrintCStr(i)EndIf'③EndIfNextiEndSub'输入一个数,判断其是否为素数PrivateSubCommand1_Click()Dimn,iAsLongDimyesAsBoolean'①booleanLetn=Val(Text1.Text)Letyes=TrueFori=2Ton\2IfnModi=0ThenLetyes=flase'②flaseEndIfNextiIfyesThenLetText2.Text=yesElse'③ElseLetText2.Text=noEndIfEndSub'输出如下图形'*'**'***'****'***'**'*PrivateSubForm_Click()DimiAsIntegerDimjAsIntegerPrintFori=-3To3'①3PrintTab(3);Forj=1To3-Abs(i)'②3-Abs(i)Print*;'③*NextPrint*NextEndSub'有一堆桃子,猴子第一天吃了总数的一半不够,又吃了一个,第二天吃了剩下的一半多一个,第三天还是如此,到第十天的时候还有一个桃子了,问一共有多少个桃子PrivateSubCommand1_Click()DimtzAsInteger'tz是桃子数DimtsAsInteger'ts是天数tz=1'①1Forts=1To9'②9tz=(tz+1)*2'③(tz+1)NexttsPrint最初共有桃子&tz'④tzEndSub'完善程序填空,随便产生十个数,并且数据从小到大输出PrivateSubCommand1_Click()Dima(10)AsIntegerFori=1To10a(i)=Int(Rnd*1000)NextiFori=1To9'①9Forj=i+1To10'②i+1To10Ifa(i)a(j)Then'③a(0)=a(i)a(i)=a(j)a(j)=a(0)'④a(j)=a(0)EndIfNextjNextiFori=1To10PrintCStr(a(i))NextiEndSub'输入飞船的速度,判定其处于哪种状态第一宇宙速度7.9111.1916.67PrivateSubCommand1_Click()DimvAsSinglev=Val(InputBox(请输入飞船速度的值))SelectCasevCaseIs16.67Label1.Caption=飞船挣脱太阳引力飞出太阳系CaseIs11.19'①11.19Label1.Caption=飞船离开地球的控制,围绕太阳转CaseIs7.91'②7.91Label1.Caption=飞船绕地球似做匀速圆周运动CaseElseLabel1.Caption=输入数据错误!EndSelect'②EndSelectEndSub在文本框中输入一个整数'判断这个数是否满足除以3的余数为2,除以5的余数为3,除以7的余数为2,如果是,在窗体上打印yes):PrivateSubCommand1_Click()x=Val(Text1.Text)IfxMod3=2ThenIfxMod5=3Then'①xmod5IfxMod7=2Then'②xmod7=2Printyes'③yesEndIfEndIfEndIfEndSub'使程序完善(假设小球从高度HOME的位置自由下落,'每次弹起的高度是下落高度的70%,当小球弹起的高度不足原来高度的千分之一时,小球很快会停止跳动,计算小球在整个弹跳过程中所经历的总路程'忽略弹起高度不足原高度千分之一的部分)PrivateSubCommand1_Click()DimHAsSingle,LAsSingleDimSAsSingle,HomeAsSingleHome=Val(InputBox(请输入一个起始高度:))H=HomeS=0DoL=0.7*H'①hS=S+H+LH=L'②lLoopWhileL=Home/1000PrintS'③sEndSub(要求用递归法求得1+2+3+…+100的值)PublicFunctionS(nAsInteger)AsIntegerIfn=1ThenS=1'①1ElseS=n+S(n-1)'②nEndIfEndFunctionPrivateSubCommand1_Click()DimSumAsIntegerSum=S(100)'③100PrintSum=&CStr(Sum)EndSub利用格里高利公式pi=4*(1-1/3+1/5-1/7+...)求得pi的值,精确到0.0001位PrivateSubCommand1_Click()DimPiAsSingle,tAsSingleDimnAsInteger,sAsSinglePi=0'①0t=1:n=1:s=1DoWhileAbs(t)=0.0001Pi=Pi+t'②tn=n+2s=-st=s/n'③s/nLoopPi=Pi*4'④4PrintPi=&CStr(Pi)EndSub'填空完成程序,编程计算1-1/2+1/3-1/4+...+1/99-1/100,单击窗体后,在窗体上显示结果。PrivateSubForm_Click()DimsAsSingleDimiAsIntegers=0'①0Fori=1To100Step1'②100IfiMod20Thens=s+1/iElses=s-1/i'③s-1/iEndIfNextiPrints=;CStr(s)EndSub'填空完成程序,使得单击显示按钮后,在窗体上显示如图99乘法表。PrivateSubCommand1_Click()DimiAsIntegerDimjAsIntegerFori=1To9Step1'①9Print;Forj=1To9Printi*j;'②i*j;PrintvbTab;NextjPrintNexti'③NextiEndSub'填空完成程序,打印如右图所示的图案(注释区别开)。'*'**'***'**'*PrivateSubForm_Click()DimiAsInteger'定义i为整型变量DimjAsInteger'定义j为整型变量DimstrAsStringFori=-2To2str=Forj=1To3-Abs(i)'①Abs(i)str=str&*NextjPrintstr;'②Printstr;Print'换行Nexti'③iEndSubPrivateSubCommand1_Click()Line(600,1300)-(2200,1300)'①600②1300Line(1400,300)-(1400,1300)'③1400EndSub'在横线处添加代码实现单击该