资源描述:
《全国计算机等级考试二级教程__C语言程序的设计课后习题答案》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、.word格式.《全国计算机等级考试二级教程--C语言程序设计》课后习题答案第一章1.1EXE1.2COBJEXE1.3顺序选择循环第二章一.选择题2.1B2.2D2.3B2.4A2.5C2.6A2.7B2.8B2.9D2.10C2.11B2.12B2.13A二.填空题2.1411122.154.24.22.16{}定义执行语句2.17关键字用户标识符2.18intfloatdouble2.19floata1=1;floata2=1;2.20存储单元2.213.52.22(a*b)/ca*b/ca/c*b2.23把常量10赋给变量s2.24位1或02.258
2、1270111111-128100000002.2632767-3276810000000000000002.2710816三.上机改错题2.28#include"stdio.h";删除行尾的";"main();/*mainfunction*/删除")"后的";",注释中的*要紧靠“/”,即应为“/*”和“*/”函数开始处遗失了一个“{”floatr,s;/*/*risradius*/,/*sisareaofcircuilar*/*/注释符号不可嵌套使用r=5.0;s=3.14159*r*r;printf("%f",s)行尾遗失了“;”函数结束处遗失了一
3、个“}”2.29#include"stdio.h"main/*mainfunction*/main后遗失了“()”.专业.专注..word格式.{floata,b,c,v;/*a,b,caresides,visvolumeofcube*/a=2.0;b=3.0;c=4.0行尾遗失了“;”v=a*b*c;printf("%f",v)行尾遗失了“;”}第三章一.选择题3.1C3.2C3.3D3.4C3.5D3.6B3.7C3.8D3.9A3.10B3.11C3.12D3.13D3.14A3.15C3.16C3.17C3.18无答案3.19C3.20B二.填空
4、题3.21(1)-2002500(2)i=-200,j=2500(3)i=-200j=25003.2212003.23一条语句;3.24;3.25100,25.81,1.8923410025.811.8923410025.811.892343.26x=127,x=127,x=177,x=7f,x=1273.27x=127,x=127,x=$127,x=$000127,x=%06d3.28a=513.789215,a=513.79,a=513.78921500,a=513.78921500三.编程题和改错题3.29修改后的程序如下:main(){doublea
5、,b,c,s,v;printf("inputa,b,c:");scanf("%lf%lf%lf",&a,&b,&c);s=a*b;v=a*b*c;printf("a=%f,b=%f,c=%f",a,b,c);printf("s=%f,v=%f",s,v);}3.30#includemain(){inta=560,b=60;printf("560minuteis%dhourand%dminute.",a/b,a%b);}3.31.专业.专注..word格式.#includemain(){inta,b;a=1500;b=350;printf("adi
6、vbis:%d",a/b);printf("amodbis:%d",a%b);}3.32#includemain(){doublea,b,c,ave;printf("input3doublenumber:");scanf("%lf%lf%lf",&a,&b,&c);printf("%.1f",(a+b+c)/3);}3.33#includevoidmain(){inta,b,c,t;printf("请依次输入整数a,b,c:");scanf("%d%d%d",&a,&b,&c);printf("你输入的值是:a=%d,b=%d,c=%d
7、n",a,b,c);t=b;b=a;a=c;c=t;printf("交换之后的值是:a=%d,b=%d,c=%d",a,b,c);}第四章一.选择题4.1A4.2A4.3A4.4D4.5C4.6A4.7B4.8C4.9D4.10C二.填空题4.11非004.12<>>=<=同级==!=同级4.13!&&
8、
9、4.15!4.16a==b
10、
11、a4
12、
13、x<-44.1714.18x<=01>04.193224.20*#.专业.专注..word格式.三.编程题4.21略4.22#include/*检查日期的合法性*/intcheckdate(intyear,
14、intmonth,intday){if(year<1