




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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字符串”字符串”占用 字节的空
2、间。11”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
5、(aj) 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; cou
6、t”s=”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(
7、a3);sb(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、四、编程题。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 2. y*
9、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 his co
10、mplaint.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 is a n
11、onsense 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 sanctions th
12、at 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 sunday.i
13、 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 duringcitys
14、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.baumga
15、rtner 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. the bal
16、loon, 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 miles/9.
17、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 platform.
18、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 big jum
19、pwhen 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 ha
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年甘肃白银市初中学业水平考试生物试卷真题(含答案详解)
- 初中语文名著阅读教学中的情感体验与价值引领研究论文
- 艺考生集训管理制度
- 苏联式户口管理制度
- 茶水间就餐管理制度
- 融资租赁的会计处理和税务处理
- 萍乡市幼儿园教师招聘幼儿考试试题及答案
- 邯郸丛台小学语文五班班级学习简报第5期
- 服装导购技巧实战培训
- 设备租赁合同书
- 第九届全国大学生化学实验邀请赛笔试试题
- 热管理技术详述
- 推荐《史蒂夫·乔布斯传》
- 应急演练评估表、评价表、评审表(模板)
- 系统集成项目总体服务方案
- CRH2动车组制动系统常见故障及处理方法
- 国开《色彩》形考任务第1-4章及答案
- 2004浙S1、S2、S3砌砖化粪池
- 热电厂管道防腐保温施工方案
- 骨髓穿刺术培训教案
- 《供应链管理》期末考试复习题库(含答案)
评论
0/150
提交评论