已阅读5页,还剩5页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
第1章 1选择题 (1) C (2) B (3) D 2填空题 (1)main (2) main (3) 有穷性、确定性、有零个或多个输入、有一个或多个输出、有效性 (4) 顺序、分支和循环(5) 自顶向下,逐步细化、模块化设计、结构化编码 第2章 1选择题 BBCDA DDBBA BBDCB 2、填空题 (1) 数字、字母、下划线 (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 (13)double (14) 0 (15)16 (16)6.6 3、编程题 (1) main() printf(int:%5dn float:%5dn char:%5dn double:%5dn long:%5dn, sizeof(int),+- sizeof(float), sizeof(char), sizeof(double), sizeof(long); (2) #define RAT 1.60934 main() float k=0.0; printf(input the km:); scanf(%f,&k); printf(nmile:%f,k*RAT); 第3章 1选择题 (1) (10):DDCDCDCDBC 2解析题 (1) x=170,x=170,x=252, x=170 x=170,x=170,x=170,x=%6d a=513.789185,a=513.79,a=513.78918457,a=513.78918457 (2) a=3b=7x=8.5y=71.82c1=Ac2=a 3编程题 (1) main() int x,y; scanf(%d%d,&x,&y); printf(商数=%d,余数=%d,x/y,x%y);system(pause); (2) main() double x,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) CCAADCCABD 2填空题 (1) ch=A & ch=Z ch=ch-32 (2) x2 x-1 y=-1 (3) a+bc & a+cb & b+ca a=b&a=c a=b | a=c | b=c (4) mark/10 k=1 case 9 (5) x0 c=x/10 y!=-2 3编程题 (1) #include main() int x; printf(please input a number:); scanf(%d,&x); if(x%2=0) printf(x is a even number); else printf(x is a odd number); (2) #include main() int x,y; printf(please input a numbero); scanf(%d,&x); if(x=-5) printf(the number is error); else if(x0) y=x; printf(%d,y);else if(x=0) y=x-1;printf(%d,y); else if(x10) y=x+1;printf(%d,y); else printf(the number is error); (3) #include main() int a,m; printf(please input a number:); scanf(%d,&a); switch(a/10) case 0: case 1: case 2:m=1;break; case 3:m=2;break; case 4:m=3;break; case 5:m=4;break; default:m=5;break; printf(%d,m); (4) #include main() float price,tax; printf(please input the price of product:); scanf(%f,&price); if(price10000) tax=price*0.05; else if(price5000) tax=price*0.03; else if(price1000) tax=price*0.02; else tax=0; printf(%f,tax); (5) #include main() float score; printf(please input the score of student:); scanf(%f,&score); if(score=85) printf(VERY GOOD); else if(score=60) printf(GOOD); else printf(BAD); 第5章 1选择题 (1)d (2) c (3)a (4)d (5)a (6)d (7)d (8)b (9)d (10)b (11)c (12)b (13)d (14)a (15)c 2填空题 (1) =0 m=m/k k+ (2) 5 4 6 (3) 3*i-2 (4) -= *= (5) 8 5 2 (6) j+ i%j=0 j=i(7)sumk sum=k j-2 (8) s=0 p=1 j=i3改错题(1) 第一处改正: For改为for第二处改正: ave=sum/4改为ave=sum/4.0(2) 第一处改正: j=9 第二处改正: m=100*i+10*j+k 3编程题 (1)#include main() int s; float n,t,sum; t=1; sum=0; n=1; s=1.0; while(n=100) sum=sum+t; n=n+1; s=-s; t=s/n; printf(sum=%10.6fn,sum); (2) 利用辗除法,直到b为0为止 main() int p,r,n,m,temp; printf(input two integer n,m:); scanf(%d,%d,&n,&m); if(n0) x1=(x2+1)*2; /*第一天的桃子数是第2天桃子数加1后的2倍*/x2=x1;day-;printf(the total is %dn,x1);(4) #include main() int i; long int n=1; for(i=1;i=10;i+) n=n*i; printf(i%5=0?%2d!=%-10ldn:%2d!=%-10ld,i,n); (5) main() int m,s,i; for(m=2;m1000;m+) s=0; for(i=1;im;i+) if(m%i)=0) s=s+i; if(s=m) printf(%d its factors are ,m); for(i=1;im;i+) if(m%i=0) printf(%d,i); printf(n); (6) #include main() int n,i,j; scanf(%d,&n); for(i=1;i=n;i+) for(j=1;j=n+i-1;j+) if(j=n-i) printf( ); else printf(*); printf(n); (7) #include main() float x0,x1,x2,fx0,fx1,fx2; do printf(Enter x1 & x2:); scanf(%f,%f,&x1,&x2); fx1=x1*(2*x1-4)*x1+3)-6; fx2=x2*(2*x2-4)*x2+3)-6; while(fx1*fx20); do x0=(x1+x2)/2; fx0=x0*(2*x0-4)*x0+3)-6; if(fx0*fx1)=1e-5); printf(x=%6.2fn,x0); 第6章 1选择题 CCDCC AADBD 2. 写出程序的运行结果 (1) sum=6 (2) Max=9,row=1,col=0(3)0 1 0 2 1 0 3 2 1 0 (4) -5 3、填空 (1)i=j=k=0 、 i4 、j5、 (2) s 、 s0,s1 、str,s1、s2,str 4、编程题 (1) #include main() int a12,count=0,i; randomize(); for (i=0;i12;i+) a=5+random(11); for(i=0;i12;i+) printf(%5d,a); count+; if(count%4=0)printf(n) ; getch(); (2) main() int a5=2,23,43,77,33; int max,min,i; long sum=0L; int count=0; float av; max=min=a0; for(i=0;imax)max=a; if(amin)min=a; av=(float)sum/5; for(i=0;iav)count+; printf(max:%dnmin:%dnav:%fncount:%d,max,min,av,count); getch(); (3) main() int score30=61,62,63,64,65,66,67,68,69,70, 71,72,73,74,75,76,77,78,79,80, 81,85,89,90,33,44,55,91,92,93; int i,count90=0,count80=0,count70=0,count60=0; for(i=0;i30;i+) printf(intput NO. %d students score:,i+1); scanf(%d,score+i); for(i=0;i=90) count90+; count80+; count70+; count60+; else if(score=80) count80+; count70+; count60+; else if(score=70) count70+; count60+; else if(score=60) count60+; printf(060:%dn6070:%dn7080:%dn8090:%dn90100:%d,30-count60,count60-count70,count70-count80,count80-count90,count90); printf(n60 or higher:%dn70 or higher:%dn80 or higher:%dn90 or higher:%dn,count60,count70,count80,count90); getch(); (4) 1、 main() char a45; int i,j,k; for(i=0;i45;i+)a= ; for(i=0;i5;i+) for(j=0;ji;j+) a9*i+j= ; for(k=0;k5;k+) a9*i+j+k=*; j=0; for(i=0;i
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 会计本科毕业论文题目
- 2025年毕业论文导师评语范文
- 企业战略分析-以小米公司为例共42文档
- 从法理角度浅析秋菊打官司
- 学位论文答辩评语
- 出淤泥而必染相对论作文
- 工程合同一口价(3篇)
- 工程合同首付款会计分录(3篇)
- 2025年会计学论文选题范文
- 毕业设计中期报告
- 2025高三英语概要写作专项练习
- 2025高一英语单词默写本
- 高中思政课课堂活动方案
- 2025税法考试题库及答案详解
- 2025至2030全球及中国绝缘体上硅(SOI)行业产业运行态势及投资规划深度研究报告
- 项目档案课件模板
- 压力管道操作安全培训课件
- 2025年公安机关人民警察职业道德和纪律要求面试题解析
- 2024-2025学年六年级上册期中考试语文试卷(江苏卷)
- 战术战伤救护培训课件
- 小儿细菌性肠炎课件
评论
0/150
提交评论