C语言程序设计决赛试题答案

C语言程序设计决赛试题答案

ID:41603495

大小:44.50 KB

页数:5页

时间:2019-08-28

C语言程序设计决赛试题答案_第1页
C语言程序设计决赛试题答案_第2页
C语言程序设计决赛试题答案_第3页
C语言程序设计决赛试题答案_第4页
C语言程序设计决赛试题答案_第5页
资源描述:

《C语言程序设计决赛试题答案》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、平顶山学院软件学院10级软工二班C语言程序设计决赛试题注:个人作品,仅供参考第一届5题:#includeintmain(){intx=1,y=1,z=1,q=1;for(x=1;x<10;x++)for(y=1;y<=12;y++)for(z=1;z<=23;z++)for(q=1;q<=44;q++)if(x+y+z+q==30&&50*x+20*y+10*z+5*q==500)printf("50元:%d张;20元:%d张;10元:%d张;5元:%d张",x,y,z,

2、q);return0;}第一届6题:#include#includevoidjisuan(intn){intsum=0;floats=0;for(inti=0;i

3、stdio.h>intmain(){5平顶山学院软件学院10级软工二班C语言程序设计决赛试题ints=21,i=0;while(s!=1){while(1){printf("Howmanystickdoyouwanttake(1~4)?");scanf("%d",&i);if(i>4

4、

5、i<0)printf("Inputerror!Pleaseinputagain!");elsebreak;}s=s-i;i=5-i;printf("%dstickleftinthepile.Computertank%d

6、stick.",s,i);s=s-i;if(s!=1)printf("%dstickleftinthepile.",s);}while(1){printf("%dstickleftinthepile.",s);printf("Howmanystickdoyouwanttake(1~4)?");scanf("%d",&i);if(i==1)break;elseprintf("Inputerror!");}printf("Youhavetakethelaststick!***Youlose!

7、n");printf(">>---------------GameOver!-------------------");return0;}第四届2题:商人过河#include#includevoidtitou(){for(intr=0;r<80;r++)printf("*");inti=2;printf("tttt%c",i);printf("Welcomecometothegame!");printf("%c",i);printf("GameRules

8、:");printf("3mentake3retainersandgoodstppasstherever,theboatcarrys2personseachtime.Inpassingtherever,atanybanknumberofmenmustbemorethanthenumbverofthe5平顶山学院软件学院10级软工二班C语言程序设计决赛试题retainers,ortheretainerswillokillthemenandtakethegoods.");printf("Gam

9、eoperations:(1)Inputthenumofmenandretainersinturn;");printf("(2)Inputerrorkeys,thegamewillrestart.");for(r=0;r<80;r++)printf("*");}intguohe(){chars1[]="men",s2[]="retainers";intm=3,r=3,m1=0,r1=0,a=0,b=0,i=0,p=0,c=0;//m、r、m1、r1为两岸商人仆从人数;i用于控制循环;a、b为登船人数;

10、p为船上人数;c为船返回是驾船者charx;while(1){system("cls");titou();printf("Thisbank:ttttThatbank:");for(i=0;i

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。