版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、2009年宁波电大c+语言程序设计第一次作业一、填空题。 1一个基本语句的最后一个字符是 。 2函数调用时,实参向形参的传送分为 和 两种传送方式。 3若应用程序onefunc.cpp中只有一个函数,这个函数的名称是 。 4变量分为全局和局部两种, 变量没有赋初值时,其值是不确定的。 5常量345l占用 字节存储空间。 6执行int i,s; for(i=8,s=0;i0;i-) s+=i; while(+i5) s+=i; 后; s的值是 。 7执行for(int i=0;i=20;i+) cout100?100:0的值赋值给变量y的赋值语句是 。10字符串”字符串”占用 字节的空间。11”
2、firstlinen2ndline”的长度是 。12执行int a=5,b; b=a+;后,a的值为 ,b的值为 。13假定x=10,y=6,则表达式2+x+和+y*3的值分别为 和 。14执行coutc+15;,显示在屏幕上的是 。15假定一个枚举类型的定义为“enum rbab,ac=3,ad,aex=ad;”,则x的值为 。16执行“cout143+17=143+17endl;”语句后得到的输出结果为 。17利用操作符+,语句序列p=p+1;f=p+15;的功能可以由一个语句完成,这个语句是 。18x+yb&ab的值相同 d、与a=b的值相同 2c+字符串“abc”以 符号作为结束符,需
3、 字节的 存储空间。( )。 a、 c,3 b、 c,4 c、0,3 d、0,4 3从定义unsigned var;可以看出,var是一个( )变量。 a、无符号短整型 b、无符号小整型 c、无符号整数 d、无符号长整型 4以下合法的c+字符常量是( )。 a、b b、 a c、 65 d、 a 5执行int k,d=8; k=d+*3;后,k和d的值分别为( )。 a、24 8 b、24 9 c、27 8 d、27 9 6以下程序的输出结果是( )。 a、11 b、10 c、9 d、10 11 for(j=10;j11;j+) for(i=9;i=j-1) coutj; 7下列的常值变量定义
4、中,错误的是( )。 a、const int ll=210; b、const char ch=67 c、const double d; d、const long ld=345; 8以下程序的输出结果是( )。 a、 c b、 d c、 e d、 f char ch; ch=c+5-3; cout0)|(e0) c、(e=0) d、(e!=0)三、程序改错题。不得增加语句、删除语句,只能在原句改正。1输入3个数,找出其中最大一个并显示出来。#include void main() int a,j,k,m;cout”请输入3个整数:”;cinajk;cout”3个数中的最大的是:”;if(aj)
5、j=a;if(ak) a=k;coutaendl;2输入10个数,计算并显示它们的合计。#include void main()double x,s;cout”请输入10个数:”;for(int j=0;jx; s=x;cout”合计:”s;四、编程序题。1设计一个程序,输入4个数,找出其中最小一个并显示出来。2输入10个整数到一个数组中,调整这10个数在数组中的排列位置,使得其中最小的一个数成为数组的首元素,并输出处理后的数据。五、写出下列程序运行后的输出结果。1#include void main() int s=0; for(int i=1;i6;i+) s+=i*i; cout”s=”
6、sendl;2#include void main() int n=10,y=1; while(n-) y+;+y; cout”y*y=”y*yendl;3#include void sb(char ch) switch(ch)case a: case a: cout”well!”;break; case b: case b: cout”good!”;break; case c: case c: cout”pass!”;break; default: cout”bad!”;break;void main() char a1=b,a2=c,a3=f; sb(a1);sb(a2);sb(a3);s
7、b(a); cout100?100:0; 10. 7 11. 17 12. 6 5 13. 12 21 14. 8215. 4 16. 143+17=160 17. f=+p+15; 18. x+y=319. a*a*a+3*a*a*a*b+3*a*b*b+b*b*b 20. 类型修饰符 形式参数表二、选择题。1.b 2.d 3.c 4.a 5.b 6.b 7.c 8.c 9.a 10.c三、程序改错题。不得增加语句、删除语句,只能在原句改正。1、cinajajk; j=a; 改正为:a=j;2、double x,s; 改正为:double x,s=0; s=x; 改正为:s+=x;待添加的隐
8、藏文字内容2四、编程题。1. #include void main() double a,b,c,d; coutabcd; if(ab) a=b; if(ac) a=c; if(ad) a=d; cout”最大数是:”a;2. #include void main() int data10,m,j=0; cout”请输入10个整数:”; for(m=0;mdatam; for(m=1;m10;m+) if(datam0) m=data0;data0=dataj;dataj=m; coutendl; for(m=0;m10;m+) coutdatam ;五、写出下列程序的运行结果。1. s=55
9、 2. y*y=441 3. good!pass!bad!well!if we dont do that it will go on and go on. we have to stop it; we need the courage to do it.his comments came hours after fifa vice-president jeffrey webb - also in london for the fas celebrations - said he wanted to meet ivory coast international toure to discuss
10、his complaint.cska general director roman babaev says the matter has been exaggerated by the ivorian and the british media.blatter, 77, said: it has been decided by the fifa congress that it is a nonsense for racism to be dealt with with fines. you can always find money from somebody to pay them.it
11、is a nonsense to have matches played without spectators because it is against the spirit of football and against the visiting team. it is all nonsense.we can do something better to fight racism and discrimination.this is one of the villains we have today in our game. but it is only with harsh sancti
12、ons that racism and discrimination can be washed out of football.the (lack of) air up there watch mcayman islands-based webb, the head of fifas anti-racism taskforce, is in london for the football associations 150th anniversary celebrations and will attend citys premier league match at chelsea on su
13、nday.i am going to be at the match tomorrow and i have asked to meet yaya toure, he told bbc sport.for me its about how he felt and i would like to speak to him first to find out what his experience was.uefa hasopened disciplinary proceedings against cskafor the racist behaviour of their fans during
14、citys 2-1 win.michel platini, president of european footballs governing body, has also ordered an immediate investigation into the referees actions.cska said they were surprised and disappointed by toures complaint. in a statement the russian side added: we found no racist insults from fans of cska.
15、baumgartner the disappointing news: mission aborted.the supersonic descent could happen as early as sunda.the weather plays an important role in this mission. starting at the ground, conditions have to be very calm - winds less than 2 mph, with no precipitation or humidity and limited cloud cover. t
16、he balloon, with capsule attached, will move through the lower level of the atmosphere (the troposphere) where our day-to-day weather lives. it will climb higher than the tip of mount everest (5.5 miles/8.85 kilometers), drifting even higher than the cruising altitude of commercial airliners (5.6 mi
17、les/9.17 kilometers) and into the stratosphere. as he crosses the boundary layer (called the tropopause),e can expect a lot of turbulence.the balloon will slowly drift to the edge of space at 120,000 feet ( then, i would assume, he will slowly step out onto something resembling an olympic diving pla
18、tform.below, the earth becomes the concrete bottom of a swimming pool that he wants to land on, but not too hard. still, hell be traveling fast, so despite the distance, it will not be like diving into the deep end of a pool. it will be like he is diving into the shallow end.skydiver preps for the b
19、ig jumpwhen he jumps, he is expected to reach the speed of sound - 690 mph (1,110 kph) - in less than 40 seconds. like hitting the top of the water, he will begin to slow as he approaches the more dense air closer to earth. but this will not be enough to stop him completely.if he goes too fast or spins out of control, he h
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 解析卷-人教版八年级上册物理《物态变化》章节测评试题(解析卷)
- 解析卷人教版八年级物理上册第4章光现象达标测试试题(含解析)
- 难点解析人教版八年级物理上册第5章透镜及其应用-透镜专项测试试题
- 解析卷-人教版八年级物理上册第5章透镜及其应用-透镜综合训练试题(含答案解析)
- 难点解析-人教版八年级物理上册第5章透镜及其应用-透镜专项攻克试题(解析卷)
- 猪精深加工项目投资计划书
- 精细化学品生产线项目商业计划书
- 网中网实训总结
- 世界设计现代史
- 2025-2030智慧城市建设技术产业格局竞争格局及投资分析报告
- 淤地坝知识培训课件
- 保密知识培训课件
- 2025昆明幼儿师范高等专科学校引进高层次人才(6人)考试模拟试题及答案解析
- 徐志摩的诗课件
- 五年级上册体育全册教案(2025-2026学年)(表格式)
- GB/T 46225-2025柔性多孔聚合物材料层压用聚氨酯泡沫规范
- 2025年日照盐粮集团有限公司公开招聘工作人员备考考试题库附答案解析
- 2025学年第一学期江浙皖高中(县中)发展共同体高三语文10月联考试题文言文详解:《宋史·陈兢传》、王夫之《宋论》
- 2025年农村会计考试试题及答案
- 2025浙江杭州市发展和改革委员会所属事业单位招聘高层次、紧缺人才4人笔试模拟试题及答案解析
- 2025-2026学年高一生物上学期第一次月考生物试卷(江苏)
评论
0/150
提交评论