您好,欢迎访问三七文档
当前位置:首页 > 建筑/环境 > 工程监理 > 江西省二级上机考试VF上机50题答案
cStr=1111001110000001111111100011111110zStr=LEFT(cstr,1)cCnt=1FORn=2TOLEN(cStr)IFSubstr(cStr,n,1)=SUBSTR(cStr,n-1,1)&&比较相邻的两个字符是否相同,相同则累计字符数,否则记#cCnt=cCnt+1ELSEzStr=zStr+ALLTRIM(STR(cCnt))+#cCnt=cCnt+1ENDIFENDIFzStr=zStr+ALLTRIM(STR(cCnt))waitwindows二进制压缩后为:+zstrcCnt=cCnt+1——cCnt=1ENDIF——endforn1=1n2=1nSum=n1+n2&&第1和2项之和i=2&&项数,初值为2DOWHILEnSum=500t=(1)n1=n2n2=t+n1nSum=nSum+n2i=i+1ENDDOi=(2)WAITWindows前+STR(i)+项的和刚好不大于500(1)n1(2)i+1str1=ThisForm.Text1.Valuestrleng=len(str1)str2=Fori=1Tostrlengzf=str(str1,i,1)DoCasecasezf='a'.AND.zf='z'strasc=ASC(zf)+3ifstrascASC(z)strasc=strasc-26endifstr2=str2+CHR(strasc)casezf='A'.AND.zf='Z'strasc=asc(zf)+3ifstrascASC(Z)strasc=strasc-26endifstr2=str2+CHR(strasc)otherwisestr2=str2+zfendcaseendforThisForm.text2.value=str2CloseThisformzf=str(str1,i,1)——zf=substr(str1,i,1)CloseThisform——releasethisformDimea(40)store0toastore0toi,jnum=(1)Fori=1Tonuma(1)=1a(i)=1Forj=i-1To2Step-1(2)nextForj=1Toi@i,j*5saystr(a(j),4)NextjNexti(1)val(thisformtext1value)(2)a(j)=a(j-1)+a(j)x=INT(90*RAND())+10y=INT(90*RAND())+10ys=INT(1+2*RAND())&&随机产生运算符IFys=1Thisform.Text1.Value=STR(x,3)+++STR(y,3)+=ThisForm.Text1.Tag=STR(x+y)ELSEIFxyt=xx=yy=xENDIFThisForm.Text1.Value=STR(x,3)+-+STR(y,3)+=ThisForm.Text1.Tag=x-yENDIFThisForm.Text2.SetFocus()Text2.Value=ThisForm.Text1.Tag=x-y——ThisForm.Text1.Tag=STR(x+y)Text2.Value=——ThisForm.Text2.Value=SETTALKOFFz=123456CLEARFORx=1TOLEN(z)?SPACE(6-x)FORy=1TO2*x-1??SUBSTR((1))ENDFORENDFORFORx=LEN(z)TO1(2)?SPACE(6-x)FORy=1TO2*x-1??SUBSTR(z,x,1)ENDFORENDFOR(1)z,x,1(2)step-1CLEARINPUT请输入一个整数:TOnflag=0FORi=2TOn-1IFn/i=INT(n/i)flag=1(1)ENDIFENDFORIF(2)?STR(n)+不是一个素数!ELSE?STR(n)+是一个素数!ENDIFRETURN(1)exit(2)flag=1ys=Thisform.Optiongroup1.Option1.Valuea=VAL(Thisform.Text1.Value)b=VAL(Thisform.Text2.Value)DOCASECASEys=1Thisform.Text3.Value=a+bCASEys=2Thisform.Text3.Value=a-bCASEys=3Thisform.Text3.Value=a*bCASEys=4IFb=0Thisform.Text3.Value=a/bENDIFENDCASEys=Thisform.Optiongroup1.Option1.Value——ys=Thisform.Optiongroup1.ValueIFb=0——IFb!=0CLEARnum=0FORa=1TO500c=0d=''FORb=1TOa-1IF(1)c=c+bd=d+','+STR(b)ENDIFENDFORIFa=c?a??dnum=(2)ENDIFENDFORWAITWINDOWS完数的个数是:+STR(num)(1)a/b=int(a/b)(2)num+1s=0n=1FORi=1TO10n=n*is=s*nENDFORThisform.Text1=ss=s*n——s=s+nThisform.Text1=s——Thisform.Text1.value=sUSEszSORTTOsz1ONnum/DUSEsz1DOWHILE!EOF()bw=INT(num/100)sw=INT((num-100*bw)/10)gw=MOD(num,10)IFMOD((1),2)=0DELETEENDIF(2)ENDDOPACKLIST(1)bw+sw+gw(2)skipIFThisform.Text1.text=xslANDThisform.Text2.text=1357Thisform.Caption=欢迎登录考试系统!ELSEThisform.Caption=用户名或密码不对,请重新输入!Thisform.flag=Thisform.flag+2ENDIFIFthisform.flag=3Thisform.Caption=超过指定次数,禁止登录!Thisform.RefreshENDIFj=1p=0s=0FORi=1TO10DOWHILEj=ip=p+(1)j=j+1ENDDOs=s+pENDFOR?'s=',(2)SETTALKONRETURN(1)j^2(2)str(s)IFThisform.Label1.Visible=.T.Thisform.Label1.Visible=.F.ELSEThisform.Label1.Visible=.F.ENDIFIFThisform.Label1.Caption!=Time()Thisform.Label2.Caption=TimeENDIFThisform.Label1.Visible=.F.——Thisform.Label1.Visible=.T.Thisform.Label2.Caption=Time——Thisform.Label2.Caption=Time()SETTALKOFFCLEARFORi=10TO99sw=INT(i/10)gw=MOD(i,10)j=(1)IFPRIME(i)ANDPRIME(j)??iENDIFENDFORSETTALKONRETURN*****判断某数为素数的函数******FUNCTIONPRIME()PARAMETERxy=(2)FORk=2TOSQRT(x)IFMOD(x,k)=0y=.F.ENDIFENDFORRETURNyENDFUNC(1)gw*10+sw(2).T.Thisform.Label2.Visible=.F.Thisform.Label3.Visible=.F.xi=Val(Thisform.Text1.Value)IFxi0Thisform.Label3.Visible=.T.ELSEFORi=2TOSqrt(xi)IFMod(xi,i)=0LoopENDIFENDFORIFi=Sqrt(xi)Thisform.Label2.Visible=.T.ELSEThisform.Label3.Visible=.T.ENDIFENDIFLoop——exitIFi=Sqrt(xi)——IFiSqrt(xi)IFThisform.Label1.Fontsize36Thisform.Label1.Fontsize=(1)ELSEIFThisform.Label1.Fontsize=36Thisform.Label1.Fontsize=(2)ENDIFENDIF(1)Thisform.Label1.Fontsize+1(2)8SETTALKOFFnCnt=0FORi=1TO10ACCEPT请输入第+STR(i,2)+个数字:TOxIFMOD(x/2)=0nCnt=nCnt+1ENDIFENDFOR?偶数个数的统计结果是:,nCntCANCELIFMOD(x/2)=0——IFMOD(val(x),2)=0?偶数个数的统计结果是:,nCnt——?偶数个数的统计结果是:,+str(nCnt)CLEARFORa=1TO10000x=LEN(ALLTRIM(STR(a)))b=0FORc=1Toxz=SUBSTR(ALLT((1))b=b+VAL(z)**xENDFORIF(2)?Ls,aENDIFENDFOR(1)str(a)),c,1(2)a=bSETTALKOffCLEARINPUTA=TOaCLEARThisform.label1.visible=.t.docasecasetype('a')=CThisform.label1.caption=a+--字符型数据casetype('a')=DThisform.label1.caption=a+--日期型数据casetype('a')=NThisform.label1.caption=a+--数值型数据endcaseSETTALKONThisform.label1.caption=a+--日期型数据——Thisform.label1.caption=dtoc(a)+--日期型数据Thisform.label1.caption=a+--数值型数据——Thisform.label1.caption=str(a)+--数值型数据SETTALKOFFclearS=1N=1X=2Y=1DOWHILEN(1)S=S+Y/XY=XX=(2)N=N+1ENDDO?1+1/2+2/3+3/4+...=,SSETTALKON(1)30(2)X+1settalkoffclearfork=1to3fori=1toiif(k=1,5,4)??iif(k=1,space(5-i),space(i))forj=1toif(k=1,2*i-1,9-2*i)??*endfor?endforendforsettalkonfork=1to3——fork=1to2forj=1toif(k=1,2*i-1,9-2*i)修改为:forj=1toiif(k=1,2*i-1,9-2*i)settalkoffs=(1)fori=1to200s=s+(2)endforThisForm.Text1.Value=ssettalkon(1)0(2)i*(i+1)ifthis.value=1thisform.text1.fontunderline=.t.elsethisform.text1.fontStrikethru=.f.endififthis.value=1thisform.text1.fontStrikethru=.t.elsethisform.text1.fontunderline=.f.endifthisform.text1.fontStrikethru=.f.修改为:thisform.text1.fontStrikethru=.t.thi
本文标题:江西省二级上机考试VF上机50题答案
链接地址:https://www.777doc.com/doc-2336682 .html