最新电大C++语言程序设计期末复习题(本)资料考试小抄.docx

上传人:l**** 文档编号:62343514 上传时间:2022-11-22 格式:DOCX 页数:16 大小:18.54KB
返回 下载 相关 举报
最新电大C++语言程序设计期末复习题(本)资料考试小抄.docx_第1页
第1页 / 共16页
最新电大C++语言程序设计期末复习题(本)资料考试小抄.docx_第2页
第2页 / 共16页
点击查看更多>>
资源描述

《最新电大C++语言程序设计期末复习题(本)资料考试小抄.docx》由会员分享,可在线阅读,更多相关《最新电大C++语言程序设计期末复习题(本)资料考试小抄.docx(16页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。

1、最新电大C+语言程序设计期末复习题(本)资料考试小抄电大C+语言程序设计复习题资料参考 一、单选题 1 在定义函数的格式类型修饰符 函数名 (形式参数表)函数体;中,函数体可以是( )。A、基本语句 B、复合语句 C、空语句 D、语句序列 2ABAB的值( )。A、为true B、为false C、与AB 的值相同 D、与AB的值相同 3每一个实在参数就是一个( )。A、表达式 B、常量 C、变量 D、函数调用 4. 假定AB为一个类,则该类的拷贝构造函数的声明语句为_。 A AB(AB x); B AB(AB x) C AB(AB x); D AB(AB* x) 5. 对于结构中定义的成员,

2、其隐含访问权限为_。 A public B protected C private D static 6当运用fstream流类定义一个流对象并打开一个磁盘文件时,文件的隐含打开方 式为_。 A ios:in B ios:out C ios:in | ios:out D 没有 7在PC机中运行的C+ 语言程序,char类型的数据占 字节。 A、1 B、2 C、3 D、4 8指出下列哪种基本类型是错误的 B 。A、float B、integer C、char D、long 9若a,b,c均为整型变量,则表达式a=2,b=a+2,c=0的值为 。A、不定 B、2 C、4 D、0 10设char t

3、=A;则表达式5+0.6+t值的数据类型为 。A、int B、float C、不确定 D、double 11以下 为不正确的if语句。A、if (x>y); B、if (x= =y) x+y; C、if (x! = y) cin>>x else cin>>y; D、if(x<y) x+;y+; 12指向数组元素为整型的一维数组的指针变量的定义是 。A、int *p( ) B、int (*p)( ) C、int *p4 D、int (*p)4 13以下关于switch语句和break语句的描述中不正确的是 。A、 break语句不能用于循环语句和switch语

4、句外的任何其它语句 B、 switch语句中运用break语句或continue语句的作用相同 C、 在循环语句中运用break语句是为了使流程跳出循环体,提前结束循环 D、 在循环语句中运用continue语句是为了结束本次循环,而不是终止整个循环的执行。14下列关于函数定义的说法,正确的是 。A、函数定义时,可以嵌套 B、函数定义不行以嵌套,但可以嵌套调用 C、主函数main()内可以定义函数 D、函数定义可以嵌套,调用也可以嵌套。15若有以下说明语句 int a34=2,3,4,5,3,4,5,6,4,5,6,7; 则正确对数组元素引用为 。A、*(a+1) B、*(a3+2) C、a1

5、+3 D、a00 16若定义如下的共同体类型变量x,则x所占用的内存字节数为 (以IBM PC机为例) union data int i; char ch; double f; x; A、7 B、11 C、8 D、10 二、填空题 1应用程序TEST.CPP中只有一个函数,这个函数的名称是 main 。25|6,56和56的值分别是 7 , 4 和 3 。3不借助于其他变量交换x和y两个变量的值,应依次执行的三个赋值语句是 x=x+y , y=x-y 和 x=x-y 。4下面的语句显示输出8行8列数组h的主对角线上的全部元素,请补充完整: for( i=0 ; i<8 ;i+)cout&

6、lt;< hii << ; 5若一函数是以return;结束运行的,说明该函数是 无参 函数。6若正常执行了如下语句: int m20,*p1=m5,*p2=m+17,n; n=p2-p1; 则n的值为 12 。7已知 A一Z的ASCII码为6590,当执行“char ch=14*5+2;cout<<ch<<endl;“语句序列后,得到的输出结果为 H 。8float和double类型的长度分别为 4 和 8 。9表达式xx+l表示成增量表达式为 x+ 。10假定p所指对象的值为36,p+l所指对象的值为49,则*+p的值为 49 。11假定要访问一个

7、结构对象x中的由a指针成员所指向的对象,则表示方法为 *(xa) 。12对一个类中的数据成员的初始化可以通过构造函数中的 初始化表 实现,也可以通过构造函数中的 函数体 实现。13在C+程序中,语句之间必需用 ; 分隔。14在C+程序中, 运算符优先级最低。15在C+语言中,在IBM PC机环境下,double型数据占 8 字节。16若k 为int型变量,则下列语句的输出为 16 。k=017; cout<<+k; 17表达式 b*b-4*a*c>0 是推断一元二次方式ax2+bx+c=0有实根的表达式。18表达式(b=10)(c=0)的值为 0 。19已知a的ASCII的十

8、进制代码为97,则表达式10+15.2-27*(a-b)的值为 52.2 。20在C+语言中, 作为双目运算符时表示的是 按位与 ,而作为单目运算时表示的是 引用 。21一个函数由函数 名 和函数 体 两部分构成。22C+在执行过程中不检查数组是否 越界 。23C+语言规定,调用一个函数时,实参数变量与形参数变量之间的数据传递是 。24指针变量的指针是 地址 。25结构体变量中的成员的引用一般形式:结构变量名成员名 。26写出满意A>B则把A+B赋给M的if语句 if(A>B) M=A+B 。27写出指向int型变量的指针变量p的一个定义语句: int *p 。 三、给出下列程序运

9、行后的输出结果 1#include<iostream.h> 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; cout<<endl; void main() char a6 =“Abcaf“; for(int i=0; ai

10、; i+) SB(ai); 答案: well ! good ! pass ! well ! bad! 2#include<iostream.h> void main() int a10= 36,25,48,14,55,40,72,40,86,27; int b1, b2; b1 = b2 = a0; for(int i= 1;i<10;i+) if(ai>b1) if(b1>b2) b2=b1; b1 = ai; cout<<b1<< <<b2<<endl; 答案:86 72 3#include<iomanip

11、.h> void main() int a8= 3,5,7,9,11,13,15,17; int *p=a; for(int i=0;i<8;i+) *p+=10; cout<<setw(5)<< *p+; if (i+1) %3=0) cout<<endl; 答案: 13 15 27 19 21 23 25 27 4. #include<iomanip.h> void LE(int* a, int* b) int x=*a; *a=*b; *b=x; cout<<*a<< <<*b<<

12、endl; void main() int x=10, y=25; LE(x,y); cout<<x<< <<y<<endl; 答案: 25 10 25 10 5. #include<iostream.h> class A int a,b; public: A() a=b=0; A(int aa, int bb) a=aa; b=bb; cout<<a<< <<b<<endl; ; void main() A x,y(2,3),z(4,5); 答案:(下面是四个数,中间有空格) 2 3

13、4 5 6#include<iostream.h> void main() int m=3,x=4,y=4,z=7; m=(m<x)?x+: m; m=(m<y)?y+: m; m=(m<z)?z+: m; cout>>“m=”>>m>>endl>>”x=”>>x>>endl>>”y=”>>y>>endl>>”z=”>>z; 程序运行后的输出结果为: 答案: m=7 x=5 y=4 z=8 7#include<iostream.

14、h> void sort(int x,int y,int z) int t; if (x>y) t=x;x=y;y=t; if(x>z) t=x;x=z;z=t; if(y>z) t=y;y=z;z=t; cout>>“x=”>>x>> >>”y=”>>y>> >>”z=”>>z; void main() int a,b,c; cin>>a>>b>>c; cout>>“a=”>>a>> >>”

15、b=”>>b>> >>”c=”>>c; sort(a,b,c); cout>>“a=”>>a>> >>”b=”>>b>> >>”c=”>>c; 假设输入为:10 6 8<CR>则程序运行后的输出结果为: 参考答案: a=10 b=6 c=8x=6 y=8 z=10a=10 b=6 c=8 8. #include<iostream.h> void prn str(char *str,int m,int n) int i; for

16、(i=1;i<m;i+) cout>>“*”; str+; for (i=1;(i<=n)(*str);i+) court>>*str+; while(*str) cout>>“*”; str+; cout>>endl; void main() char *p=“information”; prn str(p,3,4); 程序运行后的输出结果为: 答案: *form* 四、写出下列每个函数的功能 1. int Count(double a, int n) double m=0; int i; for(i=0;i<n;i+) m+

17、=ai; m=m/n; int c=0; for(i=0;i<n;i+) if(ai>=m) c+; return c; 答案:计算并返回参数数组中大于等于参数数组中全部元素平均值的元素个数 2. long fact(long n) if (n<=1L) return 1L; return n*fact(n-1L); 答案:通过函数递归调用,计算并返回参数n的阶乘 3. #include<iostream.h> void WA(int a, int n) for(int i=0;i<n-1;i+) int k=i; for(int j=i+1;j<n;

18、j+) if(aj<ak) k=j; int x=ai; ai=ak; ak=x; 答案:对参数数组中的元素进行升序排序 4#include<iomanip.h> #include<fstream.h> void JB(char* fname) /可把以fname所指字符串作为文件标识符的文件称为fname文件, /假定该文件中保存着一批字符串,每个字符串的长度均小于20。 ifstream fin(fname); char a20; int i=0; while(fin>>a) cout<<a<<endl; i+; fin.c

19、lose(); cout<<“i=“<<i<<endl; 答案:依次把参数fname所指的文件中字符输入到字符串数组a中,并输出文件中字符个数 五、编程题 1设计一程序,它输入一个整数,推断它是否是整数序列32,52,31,86,3,44,11,7,55,63中的一个;若是,显示该整数在序列中的序号(注:最小序号是1),否则显示0。 答案: #include<iostream.h> int getno(int val) int a=32,52,31,86,3,44,11,7,55,63; for(int i=0;i<10;i+) if(va

20、l=ai) return(i+1); return(0); void main() int val; cin>>val; cout<<getno(val); 2.编写一个程序,统计输入的一行字符中数字、空格及其它字符分别有多少个。 答案: #include<iostream.h> void main() int i,eng=0,numb=0,blan=0,others=0; char a100; cin.getline(a,100); for(i=0;ai;i+) if(ai<57ai>48) numb+; else if(ai=32) blan

21、+; else if(ai>65ai<90)|(ai>97ai<97+25) eng+; else others+; cout<<“eng=“<<eng<<endl<<“numb=“<<numb<<endl; cout<<“blan=“<<blan<<endl<<“others=“<<others<<endl; 3.有8个学生,每个学生四门课程的成果存放在一个8行5列的二维数组的0到7行的1到4列中,编写一个函数实现:计算每个学

22、生四门课程的总成果,并存放在该学生所在行的第0列中。 答案: #include<iostream.h> void main() int i,j; int a85=0; for(i=0;i<8;i+) for(j=1;j<5;j+) cin>>aij; /输入学生成果 for(i=0;i<8;i+) for(j=1;j<5;j+) ai0+=aij; /求学生四门课程总成果 请您删除一下内容,O(_)O感谢!2015年中心电大期末复习考试小抄大全,电大期末考试必备小抄,电大考试必过小抄请您删除一下内容,O(_)O感谢!2015年中心电大期末复习考试

23、小抄大全,电大期末考试必备小抄,电大考试必过小抄The battle for young viewers CCTV is embracing Internet culture and working with independent producers on TV shows to woo audiences under 35. Han Bing bin reports. After charming audiences with his warm smile for 14 years, China Central Television host Li Jiaming recently fou

24、nd himself targeted by a group of young netizens unhappy with his style. The complaints came after Li hosted the premiere of Rising Star on Oct 31. It is a singing competition show that originated in Israel. Many young netizens found his hosting style slow and boring and mocked it as “CCTV evening g

25、ala style“. They even initiated an online campaign to replace him. The 40-year-old hosts reaction to the criticism was surprising. During the second episode, he jokingly called himself “the slow Jiaming“ and acted much younger, talking faster and louder. “Its like selling a product. When the custome

26、rs file a complaint, you must change,“ says Li. “In the Internet age, you get feedback very quickly. These young people are so cute. When youre willing to change for them, they will quickly like you back.“ In order to win more young viewers, CCTV is relying on programs such as Rising Star to embrace

27、 Internet culture. In Rising Star, a studio audience and fans watching on television vote for their favorite singers in real time, using the instant-messaging app WeChat. Rising Star was designed to be a live broadcast, but the Chinese version isnt because of policy reasons. Still, WeChat votes by v

28、iewers at home are still a major factor in determining which contestants advance to the next round. In the shows latest episode, more than 6.5 million votes were cast via WeChat. “Now the competition among entertainment shows is very fierce. Audiences have more diverse needs. CCTV needs to embrace a

29、n open attitude, interact with young audiences and blend with the Internet,“ says Lyu Yitao, director of CCTVs entertainment channel. The producer of Rising Star, Enlight Media, says the program will have “a phenomenal effect“ given CCTVs audience base nationwide. “But it comes with a challenge,“ sa

30、ys Zhang Hang, chief producer of the program and CEO of Enlight Medias TV business. Unlike top-ranking provincial satellite channels such as Hunan TV, which have a large base of young fans thanks to a series of phenomenally popular entertainment and reality shows, CCTV productions are usually more c

31、onservative and serious, and thus have a much older audience base. “If we were to run this program on Hunan, we may attract twice as many viewers,“ says Zhang. “But since we didnt make it there, we now have to make the best out of the given conditions. And it means we have to make certain compromise

32、s.“ When the current season of Rising Star ends, Zhang says his company will conduct an overall evaluation of the program and make adjustments for future seasons. Although audience ratings havent lived up to Zhangs expectations, he says the program has already helped CCTV attract more young people.

33、According to Enlight Media, the number of people ages 15 to 35 who watched the first episode of Rising Star was 76 percent higher than the usual audience for CCTV entertainment productions. In order to attract young audiences, CCTV has been working with independent production companies. As one of CC

34、TVs closest partners, Enlight Media has produced several entertainment and reality shows for the companys channels, including the Chinese version of The Biggest Loser on CCTVs business channel and an original teenager talent show Shaonian Zhongguoqiang (Strong Young Chinese) on CCTV1. This year CCTV

35、 also licensed EE-Media, the producer of the popular Super Girl talent shows, to produce the talk show Hi! 2014, hosted by Taiwan pop star Harlem Yu and one of Chinas most popular TV stars Xie Na. The show is geared toward younger audiences. Canxing Productions, which rose to fame with the success o

36、f its Voice of China series on Zhejiang TV, also produced two talent shows for CCTV. One is an original production called Songs of China, which ended up as one of CCTVs most watched programs of 2014. The State Administration of Press, Publication, Radio, Film and Television announced earlier this ye

37、ar that, starting in 2015, only one music talent show can be aired nationwide during prime time each season, and there can be only one program based on foreign formats each year. However, domestic media report that such policies dont apply to CCTV, meaning it will become a highly desired platform by

38、 production companies. Wang Changtian, CEO of Enlight Media, confirmed to the Shanghai Securities News that its programs scheduled to air on CCTV next year, which include at least two reality shows, wont be affected. A kung fu-themed reality show, produced by Canxing, is also reportedly scheduled to

39、 run on CCTV next year. CCTV is “very active. The level of its acceptance of new ideas is even beyond my imagination,“ says Zhang Hang. “Our cooperation with CCTV will surely continue.“ When winter comes, nothing is more relaxing than a hot spring bath. For thousands of years, natural mineral-rich h

40、ot spring baths have also been used to relieve health ailments. The water found in natural hot springs contains a variety of different minerals, and the most common one is sulfur. It has a “rotten egg“ smell but is excellent for skin. The sulfur-containing water might be just what the doctor ordered when it comes to relieving pain, stress, itchy skin, arthritis and more. Hot springs resorts are thriving as biting cold winter arrives. Here we take a look at some of the best natural hot springs China has to offer.

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 应用文书 > 工作计划

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号© 2020-2023 www.taowenge.com 淘文阁