資源描述:
《人民郵電出版社c語言課后題答案》由會員上傳分享,免費在線閱讀,更多相關內(nèi)容在教育資源-天天文庫。
1、人民郵電出版社《C語言程序設計》?賈宗璞許合利主編課后答案第1章1.選擇題(1)C(2)B(3)D2.填空題(1)main(2)main(3)有窮性、確定性、有零個或多個輸入、有一個或多個輸出、有效性(4)順序、分支和循環(huán)(5)自頂向下,逐步細化、模塊化設計、結(jié)構(gòu)化編碼第2章1.選擇題BBCDADDBBABBDCB2、填空題(1)數(shù)字、字母、下劃線(2)0(3)4、8(4)(a+b)*c/(a-b)(5)-60(6)-16(7)3(8)6、4、2(9)0(10)10、6(11)5.500000(12)12、4(
2、13)double(14)0(15)16(16)6.63、編程題(1)main(){printf("int:%5d""float:%5d""char:%5d""double:%5d""long:%5d",sizeof(int),+-sizeof(float),sizeof(char),sizeof(double),sizeof(long));}(2)#defineRAT1.60934main(){floatk=0.0;printf("inputthekm:");scanf("%f",&k);
3、printf("mile:%f",k*RAT);}第3章1.選擇題(1)~(10):DDCDCDCDBC2.解析題(1)x=170,x=ㄩㄩㄩ170,x=ㄩㄩㄩ252,x=ㄩㄩㄩ170x=170,x=170ㄩㄩㄩ,x=ㄩㄩㄩ170,x=%6da=513.789185,a=ㄩㄩ513.79,a=513.78918457,a=513.78918457(2)a=3ㄩb=7x=8.5ㄩy=71.82c1=Aㄩc2=a3.編程題(1)main(){intx,y;scanf("%d%d",&x,&y);printf("
4、商數(shù)=%d,余數(shù)=%d",x/y,x%y);??system("pause");}(2)main(){doublex,y,z,avg;scanf("%lf%lf%lf",&x,&y,&z);avg=(x+y+z)/3;printf("%.1lf",avg,avg);system("pause");}第4章1.選擇題(1)~(10)CCAADCCABD2.填空題(1)ch>='A'&&ch<='Z'ch=ch-32(2)x<=10&&x>2x<=2&&x>-1y=-1(3)a+b>c&&a+c>b&&b+c>aa
5、==b&&a==ca==b
6、
7、a==c
8、
9、b==c(4)mark/10k=1case9(5)x<0c=x/10y!=-23.編程題(1)#includemain(){intx;printf("pleaseinputanumber:");scanf("%d",&x);if(x%2==0)printf("xisaevennumber");elseprintf("xisaoddnumber");}(2)#includemain(){intx,y;printf("pleaseinpu
10、tanumber£o");scanf("%d",&x);if(x<=-5)printf("thenumberiserror");elseif(x<0){y=x;printf("%d",y);}??elseif(x==0){y=x-1;printf("%d",y);}elseif(x<10){y=x+1;printf("%d",y);}elseprintf("thenumberiserror");}(3)#includemain(){inta,m;printf("pleaseinputanumb
11、er:");scanf("%d",&a);switch(a/10){case0:case1:case2:m=1;break;case3:m=2;break;case4:m=3;break;case5:m=4;break;default:m=5;break;}printf("%d",m);}(4)#includemain(){floatprice,tax;printf("pleaseinputthepriceofproduct:");scanf("%f",&price);if(price>100
12、00)tax=price*0.05;elseif(price>5000)tax=price*0.03;elseif(price>1000)tax=price*0.02;elsetax=0;printf("%f",tax);}(5)#includemain(){floatscore;printf("pleaseinputthescoreofstudent:");scan