资源描述:
《vf实验教程答案》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、VisualFoxpro实用教程部分习题答案4习题四(P128)四、编程题1.settalkoffcleauseN_listzapfori=1to20input"请输入第"+str(i,2)+"个数:"toxappeblanrepldatawithxnextindexondatatagdtdescsetordertodtgotop?datagobott?datausesettalkonretu2.settalkoffcleauseComputerdowhilenoteof()docasecase成绩>=90and成绩<=100str="优秀"case成绩>
2、=80and成绩<90str="良好"case成绩>=70and成绩<80str="中等"case成绩>=60and成绩<70str="及格"otherwisestr="不及格"endcaserepl评估withstrskipenddusesettalkonretu3.settalkoffcleauseStudentsindexon总分tagcjdescsetordertocjdirection=1dowhilenoteof()ifdirection=1fori=1to12repl班级withiifnoteof()skipendifendfelsefori
3、=12to1step-1repl班级withiifnoteof()skipendifendfendififdirection=1direction=2elsedirection=1endifenddoindexon班级tagbjsetordertobjfori=1to12ifi<10s=str(i,1)elses=str(i,2)endiffilename="Class"+s+".dbf"copyto&filenamefor班级=inextusesettalkonretu4.settalkoffcleadimea(8)useGzpmdowhilenoteo
4、f()s=实发工资yb=int(s/100)repl壹佰元withybs=s-yb*100ws=int(s/50)repl伍拾元withwss=s-ws*50ers=int(s/20)repl贰拾元witherss=s-ers*20sh=int(s/10)repl拾元withshs=s-sh*10wu=int(s/5)repl伍元withwus=s-wu*5er=int(s/2)repl贰元withers=s-er*2repl壹元withsifnoteof()skipendifenddsumtoarraya?"壹佰元:",str(a(2),4),"张"?"
5、伍拾元:",str(a(3),4),"张"?"贰拾元:",str(a(4),4),"张"?"拾元:",str(a(5),4),"张"?"伍元:",str(a(6),4),"张"?"贰元:",str(a(7),4),"张"?"壹元:",str(a(8),4),"张"usesettalkonretu习题三(P66)五、根据要求设计程序1.*用IF语句实现CLEARSETTALKOFFT=0cleaINPUT"输入三个数的值:"TOAINPUTtoBINPUTtoCIFA>BT=AA=BB=TENDIFIFA>CT=AA=CC=TENDIFIFB>CT=BB=C
6、C=TENDIF?A,B,CSETTALKONRETURN*用case语句实现CLEARSETTALKOFFT=0cleaINPUT"输入三个数的值:"TOAINPUTtoBINPUTtoCDOCASE4CASEA>BANDB>C?A,B,CCASEA>CANDC>B?A,C,BCASEB>AANDA>C?B,A,CCASEB>CANDC>A?B,C,ACASEC>BANDB>A?C,B,ACASEC>AANDA>B?C,A,BENDCASESETTALKONRETURN2.方法一:CLEARSETTALKOFFFORI=0TO9FORJ=0TO9FORK
7、=0TO9NUM=I*100+J*10+KIFNUM=I^3+J^3+K^3?NUMENDIFNEXTNEXTNEXTSETTALKONRETURN方法二:CLEARSETTALKOFFFORNUM=0TO999I=INT(NUM/100)J=INT(MOD(NUM,100)/10)K=MOD(NUM,10)IFI^3+J^3+K^3=NUM?NUMENDIFNEXTSETTALKONRETURN3.CLEARSETTALKOFFDIMEA(9)A(1)='壹'A(2)='贰'A(3)='叁'A(4)='肆'A(5)='伍'A(6)='陆'A(7)='柒'
8、A(8)='捌'A(9)='玖'DOWHILE.T.INPUT"请