欢迎来到天天文库
浏览记录
ID:57243466
大小:52.50 KB
页数:6页
时间:2020-08-07
《高一信息会考(1)培训讲学.doc》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、高一信息会考(1)精品文档《算法与程序设计》单元复习一、程序设计(写出实现流程图虚线框部分的程序代码)1.YN开始a>0?b=-a结束输出bb=a输入一个实数a2.3.YN开始i<100i=1,s=0s=s+i结束输出si=i+34.NY开始i<=100?i=1i=i+1结束输出sumsum=sum+1/isum=0收集于网络,如有侵权请联系管理员删除精品文档YYN开始i<=5s←s+xi←i+1结束输出ss←0,i←1x>0?N输入x5.6.NYNY开始x<0?c1=0,c2=0c2=c2+1结束输入x输出c1,c2x<>0?
2、c1=c1+17.已知n个数,编程求这n个数的(1)总和(2)平均值(3)最大值(4)最小值(5)正数和负数的个数收集于网络,如有侵权请联系管理员删除精品文档收集于网络,如有侵权请联系管理员删除精品文档附录:参考答案第一题:PrivateSubCommand1_Click()DimaAsIntegerDimbAsIntegera=InputBox("请输入数据a")Ifa<0Thenb=-aElseb=aEndIfPrintbEndSub第二题:PrivateSubCommand2_Click()DimxAsIntegerDim
3、yAsIntegera=800:b=1000x=InputBox("请输入数据x")Ifx4、hilei<=100sum=sum+1/ii=i+1LoopPrintsumEndSub第五题:PrivateSubCommand5_Click()DimiAsInteger,sAsInteger,xAsSingles=0:i=1DoWhilei<=5x=InputBox("请输入数据x")Ifx>0Thens=s+xEndIfi=i+1LoopPrintsEndSub第六题:PrivateSubCommand6_Click()DimxAsSingle,c1AsInteger,c2AsIntegerc1=0:c2=0DoWhil5、ei<5x=InputBox("请输入数据x")Ifx<>0ThenIfx<0Thenc1=c1+1Elsec2=c2+1EndIfEndIfi=i+1LoopPrintc1,c2EndSub第六题(数组):PrivateSubCommand7_Click()Dimx(1To5)AsIntegerDimc1AsInteger,c2AsIntegerFori=1To5x(i)=InputBox("请输入第"&i&"个数据:")Ifx(i)<>0ThenIfx(i)<0Thenc1=c1+1Elsec2=c2+1EndIfEndIf6、NextiPrintc1,c2EndSub第七题(1):PrivateSubCommand8_Click()DimsumAsSingle,iAsIntegerDimnAsInteger,xAsIntegersum=0i=1n=InputBox("n:")DoWhilei<=nx=InputBox("x:")sum=sum+x收集于网络,如有侵权请联系管理员删除精品文档i=i+1LoopPrintsumEndSub第七题(2):PrivateSubCommand9_Click()DimsumAsSingle,iAsIntegerD7、imnAsInteger,xAsIntegersum=0i=1n=InputBox("n:")DoWhilei<=nx=InputBox("x:")sum=sum+xi=i+1LoopPrintsum/nEndSub第七题(3):PrivateSubCommand10_Click()Dimd(1To100)AsIntegerDimiAsInteger,tempAsInteger,jAsIntegern=InputBox("请输入数据:")Fori=1Tond(i)=InputBox("请输入第"&i&"个数据:")NextFor8、i=2TonForj=nToiStep-1Ifd(j)
4、hilei<=100sum=sum+1/ii=i+1LoopPrintsumEndSub第五题:PrivateSubCommand5_Click()DimiAsInteger,sAsInteger,xAsSingles=0:i=1DoWhilei<=5x=InputBox("请输入数据x")Ifx>0Thens=s+xEndIfi=i+1LoopPrintsEndSub第六题:PrivateSubCommand6_Click()DimxAsSingle,c1AsInteger,c2AsIntegerc1=0:c2=0DoWhil
5、ei<5x=InputBox("请输入数据x")Ifx<>0ThenIfx<0Thenc1=c1+1Elsec2=c2+1EndIfEndIfi=i+1LoopPrintc1,c2EndSub第六题(数组):PrivateSubCommand7_Click()Dimx(1To5)AsIntegerDimc1AsInteger,c2AsIntegerFori=1To5x(i)=InputBox("请输入第"&i&"个数据:")Ifx(i)<>0ThenIfx(i)<0Thenc1=c1+1Elsec2=c2+1EndIfEndIf
6、NextiPrintc1,c2EndSub第七题(1):PrivateSubCommand8_Click()DimsumAsSingle,iAsIntegerDimnAsInteger,xAsIntegersum=0i=1n=InputBox("n:")DoWhilei<=nx=InputBox("x:")sum=sum+x收集于网络,如有侵权请联系管理员删除精品文档i=i+1LoopPrintsumEndSub第七题(2):PrivateSubCommand9_Click()DimsumAsSingle,iAsIntegerD
7、imnAsInteger,xAsIntegersum=0i=1n=InputBox("n:")DoWhilei<=nx=InputBox("x:")sum=sum+xi=i+1LoopPrintsum/nEndSub第七题(3):PrivateSubCommand10_Click()Dimd(1To100)AsIntegerDimiAsInteger,tempAsInteger,jAsIntegern=InputBox("请输入数据:")Fori=1Tond(i)=InputBox("请输入第"&i&"个数据:")NextFor
8、i=2TonForj=nToiStep-1Ifd(j)
此文档下载收益归作者所有