欢迎来到天天文库
浏览记录
ID:41595984
大小:376.50 KB
页数:92页
时间:2019-08-28
《江西省二级上机考试VF上机50题答案》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、cStr="1111001110000001111111100011111110"zStr=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"二进制压缩
2、后为:"+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(str
3、1,i,1)DoCasecasezf>='a'.AND.zf<='z'strasc=ASC(zf)+3ifstrasc>ASC("z")strasc=strasc-26endifstr2=str2+CHR(strasc)casezf>='A'.AND.zf<='Z'strasc=asc(zf)+3ifstrasc>ASC("Z")strasc=strasc-26endifstr2=str2+CHR(strasc)otherwisestr2=str2+zfendcaseendforThisForm.text2.val
4、ue=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(
5、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)ELSEIFx6、ext2.Value=""ThisForm.Text1.Tag=x-y——ThisForm.Text1.Tag=STR(x+y)Text2.Value=""——ThisForm.Text2.Value=""SETTALKOFFz="123456"CLEARFORx=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(7、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)DOCASECAS8、Eys=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
6、ext2.Value=""ThisForm.Text1.Tag=x-y——ThisForm.Text1.Tag=STR(x+y)Text2.Value=""——ThisForm.Text2.Value=""SETTALKOFFz="123456"CLEARFORx=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(
7、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)DOCASECAS
8、Eys=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
此文档下载收益归作者所有