ImageVerifierCode 换一换
格式:DOCX , 页数:41 ,大小:24.37KB ,
资源ID:3733518      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/3733518.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(二级C语言程序设计教程课后习题答案高教版.docx)为本站会员(b****4)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

二级C语言程序设计教程课后习题答案高教版.docx

1、二级C语言程序设计教程课后习题答案高教版二级C语言程序设计教程课后习题答案(高教版) - 发表日期:2006年3月3日 已经有4039位读者读过此文 第一章【1-1】.exe【1-2】.c .obj .exe 【1-3】顺序,分枝(选择),循环第二章【2-1】B 【2-2】D【2-3】B【2-4】A【2-5】C【2-6】A【2-7】B【2-8】B【2-9】A【2-10】C【2-11】B【2-12】B【2-13】A【2-14】11,12【2-15】4.2,4.2【2-16】,定义说明,执行语句【2-17】关键字,用户标识符【2-18】int,float,double【2-19】float a=b

2、=1; 【2-20】存贮单元【2-21】3.5【2-22】a*b/c,a/c*b,b/c*a【2-23】把10赋予变量s【2-24】bit,0/1【2-25】8,127,01111111,-128,10000000(补码) 【2-26】32767,-32768,111111*1,1000000000000000【2-27】8,10,16【2-28-1】(错误)#include stdio.h;main() / * main function * / float r,s; /*/*r is radius*/,/* s is area of circular */*/ r=5.0; s=3.141

3、59*r*r; printf(%fn,s)【2-28-2】(正确)#include stdio.h;main() /* main function */ float r,s; /* r is radius, s is area of circular */ r=5.0; s=3.14159*r*r; printf(%fn,s); 【2-29-1】(错误)#include stdio.hmain /* main function */ float a,b,c,v; /* a,b,c are sides, v is volume of cube */ a=2.0; b=3.0; c=4.0 v=a

4、*b*c; printf(%fn,v)【2-29-2】(正确)#include main() /* main function */ float a,b,c,v; /* a,b,c are sides, v is volume of cube */ a=2.0; b=3.0; c=4.0; v=a*b*c; printf(%fn,v);第三章【3-1】C 【3-2】C 【3-3】D 【3-4】C 【3-5】D 【3-6】B 【3-7】C 【3-8】D 【3-9】A 【3-10】B 【3-11】C 【3-12】D 【3-13】D【3-14】C 【3-15】C 【3-16】C 【3-17】C 【3

5、-18】A 【3-19】C【3-20】B 【3-21】(1)-200 2500(2)i=-200, j=2500(3)i=-200/(换行)j=2500【3-22】12,0,0【3-23】一条语句,;【3-24】; 【3-25】100 25.81 1.89234,100/25.81/1.89234,100/25.81 1.89234【3-26】x=127,x= 127,x= 177,x= 7f,x= 127【3-27】x=127,x=127 ,x=$127 ,x=$000127,x=%06d【3-28】a=513.789215,a= 513.79,a= 513.78921500,a= 513.

6、78921500【3-29-1】(错误)main double a,b,c,s,v; printf(input a,b,c:n); scanf(%d %d %d,a,b,c); s=a*b; v=a*b*c; printf(%d %d %d,a,b,c); printf(s=%fn,s,v=%dn,v);【3-29-2】(正确)main() float a,b,c,s,v; printf(input a,b,c:); scanf(%f %f %f:,&a,&b,&c); s=a*b; v=a*b*c; printf(a=%f,b=%f,c=%fn,a,b,c); printf(s=%f,v=%

7、fn,s,v);【3-30】main() int h,m; h=560/60; m=560%60; printf(%dh:%dm,h,m); getch();【3-31】main() int m,n; printf(input m & n:); scanf(%d%d,&m,&n); printf(n%d,%dn,m/n,m%n); getch(); 【3-32】main() double x,y,z,s; printf(input x,y,z: ); scanf(%lf%lf%lf,&x,&y,&z); s=(x+y+z)/3.0; printf(nAverage=%6.1lfn,s); ge

8、tch();【3-33】main() int a,b,c,t; printf(Input a,b,c: ); scanf(%d%d%d,&a,&b,&c); t=c; c=b; b=a; a=t; printf(na,b,c=%d,%d,%dn,a,b,c); getch(); 第四章【4-1】A【4-2】A【4-3】A【4-4】D【4-5】C【4-6】A【4-7】B【4-8】A【4-9】D【4-10】A【4-11】非零,零【4-12】,= =,!=【4-13】!,&,| 【4-14】!,关系运算符,&,| 【4-15】! 【4-16】(A)a=b|a4【4-17】1【4-18】xm0)|(m

9、1=m0)&(d1=d0) age=y1-y0; else age=y1-y0-1; printf(nThe student age is %d,age); getch();【4-23】main() int m; printf(ninput a integer: ); scanf(%d,&m); if (m%2=0) printf(n%d is event.,m); else printf(n%d is ord.,m); getch();【4-24】main() int a,b,c,max; printf(ninput a,b,c: ); scanf(%d%d%d,&a,&b,&c); max

10、=a; if (bmax) max=b; if (cmax) max=c; printf(max is %d,max); getch();【4-25-1】main() int x,y; printf(ninput x: ); scanf(%d,&x); if(x-5)&(x0)&(x-5)&(x10) if (x0) y=x+1; printf(nx is %d , y is %d,x,y); else printf(input x is error ! %c,007); getch();【4-25-3】main() int x,y; printf(ninput x: ); scanf(%d,

11、&x); if (x-5)&(x0)&(x10) y=x+1; printf(nx is %d , y is %d,x,y); getch();【4-25-4】main() int x,y; printf(ninput x: ); scanf(%d,&x); switch(x) case -4: case -3: case -2: case -1: y=x;break; case 0 : y=x-1;break; case 1 : case 2 : case 3 : case 4 : case 5 : case 6 : case 7 : case 8 : case 9 : y=x+1;brea

12、k; default : printf(Input x error ! %c,7); printf(nx is %d , y is %d,x,y); getch(); 第五章【5-1】D【5-2】C【5-3】B【5-4】C【5-5】C【5-6】B【5-7】D【5-8】A【5-9】D【5-10】D【5-11】5,4,6【5-12】死循环【5-13】-1【5-14】11【5-15】d=1,k+,k=0,xamin【5-17】main() int i,s=1,k=-1; for (i=1;i=50;i+) s=s+k*(2*i+1); k=-k; printf(s=%d,s); getch();【5

13、-18-1】main() int i=1; double e=1.0,s=1.0; for(i=1;i=1e-04) /* 8 times */ s=s*i; i+; e=e+1/s; printf(e=%10.6f,e); getch();【5-19】main() int y,k=0; for(y=1000;y=2000;y+) if (y%4=0&y%100!=0|y%400=0) printf(%10d,y);k+; if (k%3=0) printf(n); getch();【5-20】#include main()int i,j,n; printf(Input n (1-10):);

14、 do scanf(%d,&n); while (n10);for (i=1;i=n;i+) for (j=1;j=40-i;j+) printf( ); for (j=1;j=2*i-1;j+) printf(*); printf(n); for (i=n+1;i=2*n-1;i+) for (j=1;j=40-2*n+i;j+) printf( ); for (j=1;j=4*n-1-2*i;j+) printf(*); printf(n); getch(); 第六章【6-1】B【6-2】D【6-3】A【6-4】A【6-5】B【6-6】D【6-7】D【6-8】B【6-9】A【6-10】A【

15、6-11】C【6-12】26【6-13】1【6-14】ctype.h【6-15】1 【6-16】10A20B30C40D【6-17】7.29 101.298AB【6-18】A7.29B101.298【6-19】A B C 【6-20】#include main() int k=0; char ch; while(ch=getchar()!=10) k+; printf(%4c%4d,ch,ch); if(k%3=0) printf(n); getch();【6-21】#include main() long k=0; char ch; while(ch=getchar()!=EOF) if (

16、ch=0&ch=9) ch=ch-0; k=k*10+ch; printf(%ld,k);getch();【6-22】#include main() int flag,k=0; char ch; while(ch=getchar()!=EOF) if (ch=10) k+; flag=0; else flag=1; if (flag=1) k+; printf(n The line number is %dn,k);getch();【6-23】#include main() int k=0; char ch; while(ch=getchar()!=10) if (ch=a&ch=z) k+;

17、 printf(n The lower letter number is %dn,k);getch();【6-24】#include main() int i,j,n; printf(Input line number : ); scanf(%d,&n); for(i=1;i=n;i+) for (j=1;j=40-i;j+) printf( ); for(j=1;j=2*i-1;j+) printf(%c,64+i); printf(n); getch(); 第七章【7-1】C【7-2】C【7-3】B【7-4】C【7-5】A【7-6】D【7-7】A【7-8】12【7-9】9.000000【7

18、-10】4【7-11】n=1,s【7-12】=y,z*x【7-13】1,s*i,0,f(k)【7-14-1】(错误)main()int m; printf(Input a number: ); scanf(%d,&m); m=fun(m); if (m=1) printf(nThis number is a primer !n); else printf(nThis number is not a primer !n);getch(); fun(int n) int k,yes; for (k=2;k=n/2;k+) if (n%k=0) yes=0; else yes=1; return y

19、es;【7-14-2】(正确)main()int m; printf(Input a number: ); scanf(%d,&m); m=fun(m); if (m=1) printf(nThis number is a primer !n); else printf(nThis number is not a primer !n);getch(); fun(int n) int k,yes=1; for (k=2;k=n/2;k+) if (n%k=0) yes=0; return yes;【7-15】main()int a,b; printf(Input a & b:); scanf(%

20、d%d,&a,&b); printf(n%d%d=%d,a,b,mymod(a,b); getch();mymod(int a, int b)int z; z=a%b; return z; 【7-16】float fun(int n)return (1.0/n); main()int i,n,k=1; float s=0.0; printf(Input n:); scanf(%d,&n); for(i=1;i=n;i+) s+=k*fun(i); k=-k; printf(ns=%8.6f,s); getch();【7-17】float f(int m) float t=1.0; int i;

21、 for (i=2;i=m;i+) t-=1.0/(i*i); return t;main()int n; printf(Input n:); scanf(%d,&n); printf(nt=%8.6f,f(n); getch();【7-18】#include float f(float x) float z; z=x*x-5*x+4; return z;main()float x,y1,y2,y3; printf(Input x: ); scanf(%f,&x); y1=f(2); y2=f(x+15); y3=f(sin(x); printf(y1=%10.4fn,y1); printf(

22、y2=%10.4fn,y2); printf(y3=%10.4fn,y3); printf(n* END *); getch();第八章【8-1】A【8-2】B【8-3】B【8-4】C【8-5】B【8-6】B【8-7】C【8-8】D【8-9】B【8-10】C【8-11】C【8-12】C【8-13】110【8-14】7 1【8-15】char *p=ch;,p=&ch;,scanf(“%c”,p);,p=a;,printf(“%c”,p);【8-16】s=p+3;,s-=2,50,*(s+1),2,10 20 30 40 50【8-17-1】fun(x,y)int *x,*y;int z1,z2

23、; z1=*x+*y; z2=*x-*y; *x=z1; *y=z2;main()int *a,*b,A,B; a=&A,b=&B; printf(input two numbers: ); scanf(%d%d,a,b); printf(a,b=%d,%dn,*a,*b); printf(before call function:n); printf(a=%d b=%dn,*a,*b); fun(a,b); printf(after call function:n); printf(a=%d b=%dn,*a,*b); getch();【8-17-2】fun(x,y)float *x,*y;

24、float z1,z2; z1=*x+*y; z2=*x-*y; *x=z1; *y=z2;main()float *a,*b,A,B; a=&A;b=&B; printf(input two real numbers: ); scanf(%f%f,a,b); printf(a,b=%f, %fn,*a,*b); printf(before call function:n); printf(a=%f b=%fn,*a,*b); fun(a,b); printf(after call function:n); printf(a=%f b=%fn,*a,*b); getch();【8-18】fun(int *a,int *b,int *c) int max,min; max=*a;min=*a; if (*b*a) max=*b; if (*bmax) max=*c; if (*cmin) min=*c; *a=max;*c=min;main()int a,b,c; printf(Input a,b,c: ); scanf(%d%d%d

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1