资源描述:
《c新教材课后习题参考答案汇总2011》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、第一章一、判断题12345678FFTFTFFF第二章一、判断题12345678910FTFFFTTFFT二、选择题12345678910DACCDDCBCC三、填空题1、1个2、11.53、28454、运算符的优先级结合性5、double6、intk1=7,k2=7;-27、2.5000007.5000008、2.0000009、Double10、整型(int)第三章一、选择题123456DACCCA二、阅读下列程序,写出运行结果1、567811,212、n=69k=963、1440444、3133321100105、(1)52,’$’,9.170000,3.141593(2)
2、52,’9’,0.170000,3.141593(3)52,’9’,0.170000,3.1415936、3.00%5.00%6.007.483三、程序设计题1、#definePI3.1415#include“stdio.h”main(){floatr,h,v;printf(“inputr,h:”);scanf(“%f,%f”,&r,&h);v=PI*r*r*h;printf(“v:%f”,v);}2、#include“stdio.n”main(){chara,b,c;printf(“inputa,b,c:”);scanf(“%c,%c,%c”,&a,&b,&c);print
3、f(“%c,%d”,a,a);printf(“%c,%d”,b,b);printf(“%c,%d”,c,c);}3、#include“stdio.h”main(){intk;printf(“k=”);scanf(“%d”,k);printf(“%o,%x”,k,k);}4、#include“stdio.h”main(){charch;printf(“inputch:”);scanf(“%c”,&ch);clrscr();printf(“%c%c”,ch,ch);printf(“%c%c”,ch,ch);printf(“%c%c”,ch,ch);printf
4、(“%c”,ch,ch);printf(“%c%c”,ch,ch);printf(“%c%c”,ch,ch);printf(“%c%c”,ch,ch);}5、#include“stdio.h”main(){floatcj1,cj2,cj3;printf(“inputcj1,cj2,cj3:”);scanf(“%f,%f,%f”,&cj1,&cj2,&cj3);printf(“总成绩为:%5.1f,平均成绩为:%4.1f”,c1+c2+c3,(c1+c2+c3)/3);}第四章一、单项选择题1234567BACABAB二、阅读下列程序,写出运行结果1.F2.Hell
5、o!Goodmorning!Bye-Bye!3.x=’a’&&c<=’u’__c=c-21_______2.scanf(“%d,%d,%d”,&x,&y,&z);y>z四、程序设计题1.#include#includemain(){floatx;printf(“inputx”);scanf(“%f”,&x);if(x>0)printf(“%f”,sqrt(x));elseif(x<0)printf(“%f”,fabs(x));elseprintf(“Bye,Bye”);}2.#includemain(
6、){charc;c=getchar();if(c>=’A’&&c<=’Z’)putchar(c+32);elsec=getchar();}3.#includemain(){intscore,grade;printf("Inputscore:");scanf("%d",&score);grade=score/10;switch(grade){case0:case1:case2:case3:case4:case5:printf("grade=E");break;case6:printf("grade=D");break;case7:printf("grade=C")
7、;break;case8:printf("grade=B");break;case9:case10:printf("grade=A");break;default:printf("noscore");break;}}4.#includemain(){intx,sum;scanf(“%d”,&x);if(x>=1000&&x<=9999)sum=x%10+x/10%10+x/100%10+x/1000;printf(“sum=%d”,sum);}5.#includ