电大《C++语言程序设计》第一次作业.doc

上传人:椰子壳 文档编号:5080257 上传时间:2020-02-01 格式:DOC 页数:10 大小:95KB
返回 下载 相关 举报
电大《C++语言程序设计》第一次作业.doc_第1页
第1页 / 共10页
电大《C++语言程序设计》第一次作业.doc_第2页
第2页 / 共10页
电大《C++语言程序设计》第一次作业.doc_第3页
第3页 / 共10页
电大《C++语言程序设计》第一次作业.doc_第4页
第4页 / 共10页
电大《C++语言程序设计》第一次作业.doc_第5页
第5页 / 共10页
点击查看更多>>
资源描述

《电大《C++语言程序设计》第一次作业.doc》由会员分享,可在线阅读,更多相关《电大《C++语言程序设计》第一次作业.doc(10页珍藏版)》请在三一文库上搜索。

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 ou

20、t of control, he has a stabilization parachute that can be deployed to slow him down. His team hopes its not needed. Instead, he plans to deploy his 270-square-foot (25-square-meter) main chute at an altitude of around 5,000 feet (1,524 meters).In order to deploy this chute successfully, he will hav

21、e to slow to 172 mph (277 kph). He will have a reserve parachute that will open automatically if he loses consciousness at mach speeds.Even if everything goes as planned, it wont. Baumgartner still will free fall at a speed that would cause you and me to pass out, and no parachute is guaranteed to work higher than 25,000 feet (7,620 meters).cause there

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 绩效管理


经营许可证编号:宁ICP备18001539号-1