资源描述:
《程序设计技术第三版_(熊壮_着)_重庆大学出版社_课后答案》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、程序设计技术第三版(熊壮著)重庆大学出版社习题1一、单项选择题DADDDBCCD(注:第7小题无正确选项,正确答案为-12)二、填空题①主②main③x=x*(x+b)④普通、格式、分隔和转义⑤指定输出数据格式⑥voidmain()⑦"howareyou!"三、阅读程序题1.9,11,9,102.2,-1,-13.aabbccabc4.2,25.575767.5864000,-789.12402367.5864000,-7.89e+00267,86,-789.12,67.5864000,-789.124023,67.5864000,-789.1240236.758
2、640e+001,-7.89e+002A,65,101,411234567,4553207,12d68765535,177777,ffff,65535COMPUTER,COM.6.a+c=102a+c=ff+m=17.950000a+m=17.650000c+f=102.300000double=1746.150019四、程序设计题//xt010401.cpp#include#definePI3.1415926voidmain(){doubler,h;printf("请输入半径r和高h:");scanf("%lf,%lf",&r,&h);prin
3、tf("圆半径:%lf",2*PI*r);printf("圆面积:%lf",PI*r*r);printf("圆球表面积:%lf",4*PI*r*r);printf("圆球体积:%lf",4.0/3*PI*r*r);printf("圆柱体积:%lf",PI*r*r*h);}//xt010402.cpp#includevoidmain(){intc;printf("Inputacharacter:");c=getchar();printf("%ct%d",c,c);}//xt010403.cpp#include4、h>voidmain(){intx,y,h=30,f=90;x=(4*h-f)/2;y=(f-2*h)/2;printf("鸡:%d,兔:%d",x,y);}//xt010404.cpp#include#includevoidmain(){doublea,b,c,s,area;printf("请输入三角形的三条边长(注意三条边长应能够构成三角形):");scanf("%lf,%lf,%lf",&a,&b,&c);s=(a+b+c)/2;area=sqrt(s*(s-a)*(s-b)*(s-c));printf("三角形的面积是
5、:%lf",area);}//xt010405.cpp#includevoidmain(){doublef,c;printf("请输入华氏温度:");scanf("%lf",&f);c=5.0/9.0*(f-32);printf("与华氏温度%.2lf对应的摄氏温度是:%.2lf",f,c);}//xt010406.cpp#includevoidmain(){charc1,c2,c3,c4,c5;printf("请输入需加密的字符串(5个字符):");c1=getchar();c2=getchar();c3=getcha
6、r();c4=getchar();c5=getchar();printf("加密后的字符串是:");putchar(c1+5);putchar(c2+5);putchar(c3+5);putchar(c4+5);putchar(c5+5);printf("");}习题2一、单项选择题CBADCCCAAC二、填空题①a+b==0&&a*b!=0②逻辑与③逻辑或④continue⑤(c=getchar())!=''⑥%c三、阅读程序题答案:答案:⎧−1−−−−(x<0)⎪sign()x=⎨0−−−−−(x=0)⎪⎩1−−−−−(x>0)该程序所完成功能的函数关
7、系为:答案:答案:答案:答案:四、程序设计题/*xt020401.cpp*/#includevoidmain(){intnum;printf("****Inputnum:****");scanf("%d",&num);if(num%3==0&&num%5==0&&num%7==0)printf("**YES!**");elseprintf("**NO!**");}/*xt020402.cpp*/#includevoidmain(){inth=0;floatx,y,x0=2,y0=2,d1,d2,d3,d4;print
8、f("**