c++期末复习资料
CAD期末考试复习资料

CAD期末考试复习资料一、单项选择1、autocad的坐标体系,包括世界坐标和(d)坐标系。
a、绝对座标b、平面坐标c、相对座标d、用户座标2、autocad无法处置以下哪类信息(d)。
a、矢量图形b、光栅图形c、文字信息d、声音信息3、autocad软件不能用来进行(b)。
a、建筑设计b、文字处理c、电路设计d、零件设计4、采用下面的哪个操作方式可以顺利完成对选好图形的移动(a)a、moveb、rotaec、copyd、mocoro5、用line命令图画出来一个矩形,该矩形中存有(b)图元实体。
a.1个b.4个c.不一定d.5个6、下列选项中,与快速保存“qsave”命令作用相同的是(d)。
a、命令行输出“saveas”b、下拉菜单【文件】/【另存为(a)?】c、命令行输出“save”d、下拉菜单【文件】/【留存(s)】7、在继续执行fillet命令时,先应当设置(a)。
a.圆弧半径rb.距离dc.角度值d.内部块block8、剪切物体需用(a)命令。
a.trimb.extendc.stretchd.chamfer9、当采用line命令半封闭多边形时,最快的方法就是(a)。
a.输入c回车b.输入b回车c.输入plot回车d.输入draw回车10、autocad中的图层数最多可设置为(b)。
a.10层b.没有限制c.5层d.256层11、cp是哪个命令的热键名(b)。
a.cirlceb.copyc.chamferd.splinedit12、circle命令中的t选项就是指以(d)方式画圆弧。
a.端点、端点、直径b.端点、端点、半径c.切点、切点、直径d.切点、切点、半径13、在执行solid命令后,希望所画的图元内部填充,必须设置(a)。
a.fill为onb.fill为offc.ltscaled.color14、offset命令前,必须先设置(c)。
a.比例b.圆c.距离d.角度15、应用倒角命令“chamfer”进行倒角操作时:(c)a、无法对多段线对象展开角b、可以对样条曲线对象展开倒角c、无法对文字对象展开倒角d、无法对三维实体对象展开倒角16、移动圆对象,使其圆心移动到直线中点,需要应用:(d)a、正交b、捕捉c、栅格d、对象捕捉17、拉伸命令“stretch”拉伸对象时,不能:(a)a、把圆弯曲为椭圆b、把正方形弯曲成长方形c、移动对象特定点d、整体移动对象18、无法应用领域浇水命令“trim”展开浇水的对象就是(d)a、圆弧b、圆c、直线d、文字19、autocad中cad标准文件后缀名为(a):a、dwgb、dxfc、dwtd、dws20、多次复制“copy”对象的选项为:(a)a、mb、dc、pd、c21、在autocad中给一个对象选定颜色的方法很多,除了(d):a、轻易选定颜色特性b、随层“bylayer”c、随块“byblock”d、随机颜色22.在cad中在用line命令绘制封闭图形时,最后一直线可敲(a)字母后回车而自动封闭a.cb.gc.dd.023.在cad中单位设置的快捷键就是(b)a.umb.unc.ctrl+ud.alt+u24.cad软件中我们一般都用(c)单位来做图以达到最佳的效果a.米b.厘米c.毫米d.分米25.在cad中文本窗口切换的快捷键是(b)a.f1b.f2c.f3d.f426.在cad中圆弧快捷键就是(b)a.trb.ac.recd.pl27.在cad中绘制圆的直径按(d)键a.bb.wc.pd.d28.在cad中定数等分的快捷键是(d)a.mib.lenc.f11d.div29.在cad中点的快捷键是(c)a.wb.oc.pod.tr30.在cad中图形界限的命令就是(a)a.limitsb.ctrl+0c.alt+1d.alt+231.在cad中查看距离命令是(c)a.bib.cic.did.f332.在autocad中激活其它文件中块的命令快捷键就是(b)a.ctrl+alt+cb.ctrl+cc.ctrl+shift+cd.ctrl+a33.在autocad中写块(存储块)命令的快捷键是(a)a.wb.ic.ld.ctrl+w34.在autocad中粘贴其它文件的块的命令快捷键是(d)a.vb.ctrl+atl+vc.ctrl+shift+vd.ctrl+v35.在cad中文字工具中输出下划线的命令就是(b)a.%%1b.%%uc.%%3d.contentamp;236.在cad中文字工具中输入直径符号的命令是(d)a.%%1b.%%uc.%%3d.%%c37.在cad中以下有关图层锁定的描述,错误的是(b)a.在锁定图层上的对象仍然可见b.在锁定图层上的对象不能打印c.在锁定图层上的对象不能被编辑d.锁定图层可以防止对图形的意外修改38.在cad中当一对象从图形中被删掉时,采用下列哪一个命令恢复正常该对象(a)a.ctrl+zb.cancelc.restod.replace39.在cad中建立一个圆与未知圆同心,可以采用哪个修正命令(c)a.阵列b.复制c.偏移d.镜相40.autocad的英文全称是(b)41.在cad中画回去一幅图后,在留存该图形文件时用(d)做为扩展名。
C语言期末考试复习资料-程序填空部分试题及答案

【程序填空】-——-—----——--—————--—-—-——-—-——----—--—-—-——------———-——- 功能:下面的程序是求1!+3!+5!+……+n!的和。
--——------—-—--——-—----—---——----————-—-———-—-—-—-----—*/#include <stdio.h〉main(){long int f,s;int i,j,n;/***********SPACE***********/【?】;scanf("%d”,&n);/***********SPACE***********/for(i=1;i<=n;【?】){f=1;/***********SPACE***********/for(j=1; 【?】;j++)/***********SPACE***********/【?】;s=s+f;}printf(”n=%d,s=%ld\n",n,s);}/*-—--——-——-—-——---—-----—--——--—-—--—----—---—-—-—--——-—【程序填空】----—---—---—--—-—————-—————-——---—--—----————-—--—--——-—功能:以每行5个数来输出300以内能被7或17整除的偶数,并求出其和。
--———-—--——-—--——-——--—--———--—————-——--—--—-———--—--——*/ #include <stdio.h〉#include <conio.h〉main(){int i,n,sum;sum=0;/***********SPACE***********/【?】;/***********SPACE***********/for(i=1; 【?】;i++)/***********SPACE***********/if(【?】)if(i%2==0){sum=sum+i;n++;printf("%6d",i);/***********SPACE***********/if(【?】)printf(”\n");}printf(”\ntotal=%d”,sum);}/*———-—----———----—----—---———————--—-————----——----—---—【程序填空】——---—————-———-—————---—-—----—--——-—--—--——-—--——————-——功能:求100-999之间的水仙花数说明:水仙花数是指一个三位数的各位数字的立方和是这个数本身。
c语言期末复习资料3

1.C程序的源程序由预处理命令和( )组成。
(A)函数(B) 语句(C) 保留字(D) 标识符2. 下面程序段中,与if(x%2)中的x%2所表示条件等价的是( )。
scanf("%d",&x);if(x%2) x++;(A)x%2==0 (B) x%2!=1 (C) x%2!=0 (D) x%2==13. 执行下面的C语句序列后,变量b的值是( )。
int a,b,c; a=b=c=1; ++a||++b&&++c;(A) 错误(B) 0 (C) 2 (D) 14. 设有C语句int a[3][4];,则每次移动过a数组一行元素的指针变量定义形式是( )。
(A)int *p; (B)int **p;(C)int (*p) [4]; (D)int *p[4];5.设有整型变量a, 实型变量f,双精度型变量x,则表达式10+'b'+x*f值的类型为( )。
(A) int (B) float (C) double (D) 不能确定6.C语言中规定,函数调用中用简单变量做实参时,它和对应形参之间的数据传递方式是( )。
(A)地址传递(B)单向值传递(C)有实参传给形参,再由形参传回给实参(D)由用户指定传递方式7.下面程序的输出是()。
#include <stdio.h>void main(){int x=10,y=3;printf("%d\n",y=x/y);}(A)0 (B)1 (C)3 (D)不确定的值8.执行下面的程序段后,B的值为()。
int x=35;char z='A';int B;B=((x&15)&&(z<'a'));(A) 0 (B) 1 (C) 2 (D) 39.以下程序的输出结果为()。
#include <stdio.h>void main(){int i=0;for(;;)if(i++==5)break;printf("%d\n",i);}(A) 0 (B) 5 (C) 6 (D) 前3个选项都错10.已知:char s[4] = "cba"; char *p; 执行语句序列p =s;printf("%c\n",*p+1);后,其输出为()。
c语言期末复习资料

c语言期末复习资料C语言是计算机科学中非常基础的一门编程语言,是程序员必须掌握的技能之一。
由于其简单易学的特点和广泛的应用范围,越来越多的人开始学习和使用C语言。
期末考试是C语言学习过程中的重要节点,为了帮助考生顺利通过考试,本文整理了一些C语言期末复习资料以供参考。
一、基础知识1.变量和数据类型C语言中的变量用于存储程序中使用的数据,数据类型是指变量所代表的数据的类型。
常见的C语言数据类型包括整型、浮点型、字符型、布尔型等。
掌握变量和数据类型的定义和使用是C 语言学习的第一步。
2.运算符和表达式C语言中的运算符用于对变量进行运算和操作,包括算术运算符、关系运算符、逻辑运算符等。
表达式是由变量和运算符组成的代码段,用于对变量进行操作和计算。
掌握运算符和表达式的使用和规则是C语言学习的基础。
3.条件语句和循环语句条件语句和循环语句是C语言中的两种重要的控制结构。
条件语句根据条件的真假来执行不同的代码段,常见的条件语句包括if语句和switch语句。
循环语句用于重复执行同一个代码段,常见的循环语句包括for循环、while循环和do-while循环。
掌握条件语句和循环语句的使用和应用是C语言学习的重要环节。
二、进阶技巧1.字符数组和字符串字符数组和字符串是C语言中非常常用的数据类型,用于处理字符和文本。
字符数组是由若干个字符组成的数组,字符串是由若干个字符组成的字符串常量。
掌握字符数组和字符串的定义和使用,能够更好地处理文本和数据输入输出等问题。
2.函数和指针函数是C语言中的重要的模块化编程方法,函数将程序的功能分解为若干个具有特定功能的独立模块。
指针是C语言中的重要的数据类型,它存储变量的内存地址,常用于访问复杂数据结构和实现高效的内存管理。
掌握函数和指针的使用和细节能够更好地组织程序和提高程序的执行效率。
3.结构体和文件操作结构体是C语言中用于组织复杂数据结构的数据类型,常用于存储各种类型的数据记录。
整式期末复习资料

第一章 整式及其运算复习一 幂的运算n m n m a a a +=⋅ ;m n n m mn )a ()a (a ==;n n n b a )ab (⋅=;n m n m a a a -=÷ (m ,n 都是正整数)注:1、()=-na ⎪⎩⎪⎨⎧-);(),(为奇数为偶数n a n a nn ()=-na b ⎪⎩⎪⎨⎧---).()(),()(为奇数为偶数n b a n b a nn 2、10=a(a ≠0) (2)pp a a 1=- (a ≠0)针对练习: (1)已知31232m -=,求m=____;(2)如果20a a +=,那么2001200012a a ++的结果为(3)已知3113m n n y y y -+=,146m nx xx --=,求2m n +=__________(4)整数825m N =⨯是一个11位整数,求m___________(5)已知122,62,32===c b a,求a , b , c 之间的关系为_________(6) 若()()()43991003,4,212-=-=⎪⎭⎫ ⎝⎛⋅-=c b a ,试比较a , b , c 的大小为_____________ (7) 1002___753(填>或<) , 比较333444555543、、的大小为___________________(8) 若72=nx,则()()nn x x 322343-=________若y xy x 279,0432⋅=-+求=_______(9) 已知(2x -3)0=1,则x 的取值范围是________(10)()()3200820082125.0⨯-=___________ 78772153187⎪⎭⎫ ⎝⎛-⨯⎪⎭⎫ ⎝⎛+⨯⎪⎭⎫ ⎝⎛-=_____________(11) 若m my x 43,12+=+=,请用含x 的代数式表示y 为________________ (12) 已知,200080,200025==y x则yx 11+的值为( ) A 、1 B 、2 C 、21D 、23二 整式的计算(整式的混合运算) 1、 化简求值:(1)若2(2)10a b +++=,求{})]24(3[2522222b a ab ab b a ab ----的值(2) 已知xyz xA -=32,xyz z y B +-=23,xyz y x C -+-=222,且01)1(2=+-++z y x 求:)32(C B A --的值.(3) 已知:2,1a b a c -=-=,求:()()222a b c c b --+-=___________(4) 若a 3(3a n-2a m+4a k)=3a 9-2a 6+4a 4,求-3k 2(n 3mk+2km 2)=___________ (5) 化简求值: ()()1212-++-b a b a 其中598,987a b ==2、(整体思想)(1)已知535-++=cx bx ax y ,当3-=x 时,7=y ,求当3=x 时y 的值;(2)若22210,24x x x x -+=-=则 (3) 已知:220m m +-=,求:3232000m m ++=___(3) 已知33xx -=1,则43291237x x x x +--+1999=___________(4) 已知:3,4a b b c -=-=,求:222a b c ab bc ca ++---的值 (5) 已知012=++a a ,求200720082009a a a ++的值;(6)已知32-=xy ,求出)(523y y x xy xy -+-的值3、恒等问题:(1)、已知多项式63513212--+-+x xy y x m 是六次四项式,单项式m n y x -523与该多项式的次数相同,则=+n m (2)若多项式1)3(5)1(234-+-+--x b x x a x 中不含3x 和x 项,则=a ,=b ;若)3)(8(22n x x mx x+-++展开后不含x2和x 3项,求m ,n 分别为_____________(3)已知:222321,1A x ax x B x ax =+--=-+-,且B A 63+的值与x 无关,求a 的值(4) 若)3)(8(22b x x ax x+-++的积中不含3x 项和x 项,则a 、b 的值分别为( )A 、0=a ,0=bB 、3-=a ,1=bC 、3=a ,8=bD 、3-=a ,9-=b(5)已知:b x x x a x +-=+-610)25)(2(2恒成立,求a+b=__________(6) C x B x x x+-+-=++)1()1(4322,求B C =__________(7) 若22251(1)(1)xx a x b x c ++=++++,求23a b c +-=___________4、计算题 (1)()()22a b c d a b c d +++-+--(2)()()()()2222222312231233233xx x x x x x x --+---+++-++(3)(-1)2006+(-12)-2-(3.14-π)0; (4)(2x -3)2-(2x+3)(2x -3)(5)运用乘法公式进行简便计算:20052-2004×2006(3)已知b a ,满足()2125224)8(b b a --=÷-,()()2739÷=ab ba(1)求22b a +的值 (2)计算()()()()++++++-+11b a b a ab b a b a ab ()()()()1009921+++++⋯+++++b a b a ab b a b a ab三 平方差(a+b)(a-b)=a 2—b21、计算22112222x x ⎛⎫⎛⎫-+-- ⎪ ⎪⎝⎭⎝⎭(2)()()x y z x y z +-++(3)59.860.2⨯ (4)2200620052007-⨯(5)()()()()()224488a b a b a b a b a b -++++(6)3(22+1)(24+1)(28+1)(162+1)+1 (7)(a+b-c)(a-b+c)-(a-b-c)(a+b+c)(8)(2211-)(2311-)(2411-)…(2911-)(21011-)(9)(x 3+x 2+x+1)(x 3-x 2+x-1)-(x 3+x 2+x+2)(x 3-x 2+x-2)四 完全平方(a+b)2=a 2+2ab+b 2;(a-b)2=a 2-2ab+b 2公式变形:(1)()2222a b a b ab +=+-(2)()2222a b a b ab +=-+(3)()()222222a b a b a b ++-=+(4)()()224a b a b ab +--=1、简单计算和化简(1)()22a b -+ (2)(a+b-c)² (3)(a-b-c)²(4)()()()()22342343232x x x x +++-++-+(5)2202 (7)利用完全平方公式解方程:0161242=-+x x(8)1.23452+0.76552+2.469×0.7655. (9)2、22ab ±、ab 、2()a b ±之间关系的问题:(1)4,2a b ab +==-.则(1)22ab + =______(2)()2a b -=_________(2) 已知实数a 、b 满足(a+b )2=1,(a ﹣b )2=25,求a 2+b 2+ab 的值.(3)设2,122=+=+b a b a ,求33b a +的值3、1x a x±= 求22x y +=?的问题 (1)已知1x x+=3.(1)求221x x +的;(2)求441x x +的值(2)已知:231xx -+=0.(1)求:221x x +的值;(2)求:441xx +的值。
C语言期末复习资料

D. a = 0
36、下列程序段运行后 x 的值是 A 。
main ()
{ int a, b, c, x ;
a=b=c=0 ; x= 35 ;
if ( !a ) x-- ;
else if ( b ) ;
if ( c ) x =3 ;
printf ( "%d", x ); }
A. 34
B. 0
C. 35
{ case 1: printf ("*\n");
case 1+2: printf ("**\n"); }
case 2: printf ("**\n"); }
32、以下由 while 构成循环的次数是
D。
int i = 1 ;
while ( i == 1 ) i++;
A. 执行无限次
B. 语法错
C. 一次也不执行
17、以下程序的输出结果是 _____A_____。
# include <string.h>
main( )
{ printf ( "%d\n", strlen ("IBM\n012\1\\" ) ) ;
}
A. 9
B. 7
C. 11
D. 10
18、下列叙述中,不是 C 语言特点的是
B。
A. 简洁、紧凑,使用方便、灵活,易于学习和掌握
}
A. 10
B. 11
C. 13
D. 3
8、若以下变量均已正确说明为 char 类型,要给 x、y 和 z 输入数据,正确的是 B 。
A. scanf ( x, y, z );
C语言程序设计A期末考试复习要求

(2021.06.07)C语言程序设计A课程期末复习与考试要求(文本)王宇:怎样才能学好程序语言?现在各种程序语言都很多,什么c语言啊,c++啊java ,c#啊,各种语言都很多我们要从什么开始学习,怎么才能学好这些语言呢?以及以后的那个就业需要的知识。
希望老师以及高手给予帮助!??徐孝凯:要学好一门语言,它是学习计算机任何专业的基础.要使用计算机,就必须学会计算机能够理解的语言,以便执行相应的程序或命令.黄乐:徐老师,课件视频只有一可以正常播放,其它都没反应。
徐孝凯:请咨询电大在线的网站!吴耀:C语言很难,我们得好好学习徐孝凯:回复:C语言――对的,要学习和上机操作相结合.谢祚洲:我是新手,先来报到徐孝凯:通过学习,很快会变为老手!殷自胜:这门课考试是以什么形式进行?机试?笔试?徐孝凯:笔试!往届试卷供参考中央广播电视大学C语言程序设计A课程试卷(2)2010.1.13底考一、单选题(每小题2分,共20分)1. 由C语言源程序文件编译而成的目标文件的默认扩展名为( )。
A. cppB. cC. exeD. obj2.设x和y均为逻辑值,则x || y为假的条件是x和y( )。
A. 均为真B. 其中一个为真C. 均为假D. 其中一个为假3. 枚举类型中的每个枚举常量的值都是一个()。
A. 整数B. 浮点数C. 字符D. 记录4. 循环语句“for(i=0; i<=n; i++) S;”中循环体S被执行的次数为( )。
A. 1B. n-1C. nD. n+15. 假定有语句为“int a[4][5]={{1,3,5},{2,8}};”,则a[1][1]的值为()。
A. 3B. 5C. 8D. 106. 在下面的选项中,不能作为函数的返回值类型的是()。
A. voidB. nodeC. intD. long7. 假定x的值为5,y的值为6,则表达式x++*--y的值为()。
A. 25B. 30C. 36D. 428. 用calloc函数创建具有10个整型元素的动态存储空间的正确调用是()。
C语言期末考试复习资料

C语言期末考试复习资料C语言复习摘要一、数据类型:基本类型(整型、实型、字符型、枚举类型),构造类型(数组、结构体、共用体)、指针类型、空类型。
基本类型也叫简单类型,构造类型也叫复杂类型二、标识符:标识符只能由字母、下划线、数字构成,且必须以字母或下划线开头,且对字母的大小写敏感。
三、常量1、整型常量,如:32,0x32,0X32,0x3f,0xea,8L,8l,0672、实型常量,如:3.14,1e23,0.8E8,0.8E-8,0.8E+83、字符常量,如:‘a’,‘\n’, ‘\w’,‘\\’,‘\0’4、字符串常量,如:“windows”,“a”,(其赋值表达式和赋值语句中其本质是一个地址常量)5、地址常量,若有定义:int k,a[10];char s[20];则:&k,a,s,NULL都是地址常量6、符号常量,用宏定义实现,如:#define PAI 3.14159267、以下都是非法常量:0xfg,3.1e2.8,‘aw’,‘w\’,0x,068四、表达式(要点:先确定表达式的类型,再确定表达式的值的类型,最后确定表达式的值):1、算术表达式(应注意变量类型的自动转换——原则:低级向高级转换):(1)、整型表达式:参加运算的都是整型量,结果也是整型数。
如:x+20*9+3(2)、实型表达式:参加运算的都是实型量,运算过程中先转换成double型,结果也是double型。
如:x+20*9+3.0,x+20*9+sqrt(3)2、赋值表达式:将赋值运算符“=”右边的值赋给左边的变量,其值为赋值后左边变量的值,类型为左边变量的类型。
如:x=3(注:若x为整型变量,则该表达式的值为整型,若x实型变量,则该表达式的值为实型)3、逻辑表达式:用逻辑运算符(!,&&,||)连接的整型量,结果为整数(0或1)。
逻辑表达式可认为是整型表达式的一种特殊形式。
如:((x=3)&&(y=0))4、关系表达式:用关系运算符将两个表达式连接起来的式子,结果为整数(0或1)。
数控技术期末复习习题及答案

《数控技术》复习资料一、填空题1 。
软件插补和硬件插补的原理相同,其作用都是根据给定的信息进行计算,在计算的过程中不断向各坐标轴发出相互协调的,使数控机床按指定的运动。
2。
所谓插补,就是数据密化的过程.在实际加工过程中,常采用或来逼近零件的轮廓曲线。
3 数据采样插补的特点是插补运算分两步进行。
第一步进行,第二步进行。
4。
DDA直线插补的物理意义是使动点沿矢量的方向前进,这种方法同样适用于DDA 插补。
5. 交流主轴伺服电机,采用变频调速的方法时,基频以下调速称为调速;基频以上调速称为调速。
6。
他激式直流主轴伺服电机调速时,额定转速以下调速称为恒转矩调速,通过调整实现;额定转速以上调速称为恒功率调速,通过调整实现.7。
从CNC系统使用的微机及结构来分,CNC系统的硬件结构一般分为:单CPU 和多CPU 结构两大类。
8.刀具补偿包括刀具补偿和刀具补偿。
9。
刀具补偿的作用是把轨迹转换成轨迹。
10. 数控系统中完成插补运算的装置或程序称为插补器。
根据插补器的结构可以分为、、三种类型。
11. 采用步进电机的开环伺服系统,对于数控装置发来的一个经驱动线路放大后驱动步进电机转过一个,经过机械传动系统带动工作台移动一个脉冲当量的位移。
12。
逐点比较法是以折线逼近直线或圆弧曲线,它与给定的之间的最大误差不超过一个。
13。
编程人员以图样上的某一点为原点建立的坐标系,称为编程坐标系,编程坐标系的称为编程零点。
14.准备功能指令分为模态代码和非模态代码。
模态代码表示该代码一经在一个中应用,直到出现同组的另一个时才失效。
15.伺服系统被看作一个独立部分,与和并列为数控机床的三大组成部分.16. 数控机床的伺服驱动系统通常包括两种:和。
17。
机床数控系统中常使用的位置检测装置,按运动方式可分为型和型两类。
18。
直线式感应同步器由作相对平行移动的和组成。
1。
略 2.略3。
粗插补、精插补4。
速度、圆弧 5.恒转矩、恒功率 6.电枢电压、励磁电流7.略 8。
C语言期末复习资料

单项选择题1.char *p[10];该语句声明了一个: C 。
A) 指向含有10个元素的一维字符型数组的指针变量pB) 指向长度不超过10的字符串的指针变量pC) 有10个元素的指针数组p,每个元素可以指向一个字符串D) 有10个元素的指针数组p,每个元素存放一个字符串2.在while(!x)语句中的x与下面条件表达式等价的是: D 。
A) x!=0 B) x==1 C) x!=1 D) x==03.若二维数组a有m行n列,则下面能够正确引用元素a[i][j]的为: C 。
A) *(a+j*n+i) B) *(a+i*n+j)C) *(*(a+i)+j) D) *(*a+i)+j4 union{double k;char c;float a;}test;则sizeof(test)的值是: A 。
A)8 B)1 C)4 D)135、下面程序的输出是____D_____#include<stdio.h>void main(){int k=11;printf("k=%d,k=%o,k=%x\n",k,k,k);(%o为8进制输出,%x为16进制输出)}A) k=11,k=12,k=11 B) k=11,k=13,k=13C) k=11,k=013,k=0xb D) k=11,k=13,k=B6、在下列选项中,不正确的赋值语句是____D____.(在变量说明中,不允许连续给多个变量赋初值,而赋值语句允许连续赋值。
如下述说明是错误的:)A) ++t; B) n1=(n2=(n3=0));C) k=i=j; D) a=b+c=1;7、下面合法的C语言字符常量是_____A_____.A) '\t' B) "A" C) 65 D) A8、表达式: 10!=9的值是______D__ ___.A) true B)非零值C) 0 D) 19、C语言提供的合法的数据类型关键字是_____B___.A) Double(应该为double)B) shortC) integer(应该为int)D) Char(应该为char)10、字符(char)型数据在微机内存中的存储形式是__D__.A) 反码B) 补码C) EBCDIC码D) ASCII码11、C语言程序的基本单位是_____C______.A) 程序行B) 语句C) 函数D) 字符12、设int a=12,则执行完语句a+=a-=a*a后,a的值是_____D__A) 552 B) 264 C) 144 D) -26413、执行下面程序中的输出语句后,输出结果是__B____.#include<stdio.h>void main(){int a; printf("%d\n",(a=3*5,a*4,a+5)); }A) 65 B) 20 C) 15 D) 1014、下面程序的输出是__B________.#include<stdio.h>void main(){int x=023; (八进制)printf("%d\n",--x); }A) 17 B) 18 C) 23 D) 2415下面程序的输出的是___C______.#include<stdio.h>void main(){int x=10,y=3;printf("%d\n",y=x/y);}A) 0 B) 1 C) 3 D) 不确定的值16、已知字母A的ASCII码为十进制的65,下面程序的输出是_______A____. #include<stdio.h>void main(){char ch1,ch2;ch1='A'+'5'-'3';ch2='A'+'6'-'3';printf("%d,%c\n",ch1,ch2);}A) 67,D B) B,C C) C,D D) 不确定的值17、若要求在if后一对圆括号中表示a不等于0的关系,则能正确表示这一关系的表达式为_D_____.A) a<>0 B) !a C) a=0 D) a18、以下程序的输出结果是__D______.#include<stdio.h>void main(){ int x=10,y=10;printf("%d %d\n",x--,--y); }A) 10 10 B) 9 9 C) 9 10 D) 10 919、设有如下定义:int x=10,y=3,z;则语句printf("%d\n",z=(x%y,x/y)); 的输出结果是_D_______.A) 1 B) 0 C) 4 D) 320、为表示关系x≥y≥z,应使用C语言表达式____A__.A) (x>=y)&&(y>=z) B) (x>=y)AND(y>=z)C) (x>=y>=z) D) (x>=y) & (y>=z)21、C语言中非空的基本数据类型包括__B______.(基本数据类型有整型,字符型,浮点型,枚举类型)A) 整型,实型,逻辑型B) 整型,实型,字符型C) 整型,字符型,逻辑型D) 整型,实型,逻辑型,字符型22、若x和y都是int型变量,x=100,y=200,且有下面的程序片段:printf("%d",(x,y)); 上面程序片段的输出结果是___A____.A) 200 B) 100C) 100 200 D) 输出格式符不够,输出不确定的值23、阅读下面的程序#include<stdio.h>void main(){char ch;scanf("%3c",&ch);(%3c表示输入三个字符)printf("%c",ch); (表示输出一个字符)}如果从键盘上输入 abc<回车>则程序的运行结果是__A____.A) a B) b C) c D) 程序语法出错24、阅读下面的程序#include<stdio.h>void main(){int i,j; i=010; j=9;printf("%d,%d",i-j,i+j); }则程序的运行结果是___D_____.A) 1,19 B) -1,19 C) 1,17 D) -1,1725、阅读下面的程序#include<stdio.h>void main(){int i,j,m,n; i=8;j=10; m=++i; n=j++;printf("%d,%d,%d,%d",i,j,m,n);} 程序的运行结果是____C___;A) 8,10,8,10 B) 9,11,8,10C) 9,11,9,10 D) 9,10,9,1126、已知a=12,则表达式a+=a-=a*=a的结果是__A_____.A) 0 B) 144 C) 12 D) -26427、若已定义int a,则表达式a=10,a+10,a++的值是_B__.A) 20 B) 10 C) 21 D) 1128、阅读下面的程序#include<stdio.h>void main(){int i,j;scanf("%3d%2d",&i,&j); printf("i=%d,j=%d\n",i,j); }如果从键盘上输入1234567<回车>,则程序的运行结果是____D____.A) i=123,j=4567 B) i=1234,j=567C) i=1,j=2 D) i=123,j=4529、下面程序的输出结果是___D_____.#include<stdio.h>void main(){int a=-1, b=4, k;k=(++a<=0)&&(b--<=0);(如果&&前面部分为假则&&后面的部分就不被执行,如果前面部分为真则&&后面部分需要被执行)printf("%d,%d,%d\n",k,a,b);}A) 1,1,2 B) 1,0,3 C) 0,1,2 D) 0,0,330、下面叙述错误的是___D___A)一个由数据申明部分和执行语句组成。
CADCAM期末复习题综合

《CAD/CAM》期末复习题一、单项选择题4. 下列各项中,不属于CAM工作范畴的内容是( C )。
A.生产过程管理B.加工控制C.应力、应变分析D.质量控制5. 当前应用得最普遍的一种CAD型式是( D )。
A.检索型CADB.自动型CADC.人工型CADD.交互型CAD6. 在CAD/CAM系统中,( C )是加接CAD、CAM的纽带。
A.CAEB.CAGC.CAPPD.CAQ9. .交互型CAD系统 ( B )。
A.不需要设计人员干预B.需要设计人员干预C.不需要CAM干预D.需要CAM干预10.计算机辅助制造进行的内容有( A )。
A.进行过程控制及数控加工B.CADC.工程分析D.机床调整12.计算机辅助制造应具有的主要特性是( A )。
A.适应性、灵活性、高效率等B.准确性、耐久性等C.系统性、继承性等D.知识性、趣味性等1.在CAD/CAM系统中,CAM是指( B )。
A. 计算机辅助设计B. 计算机辅助制造C. 计算机辅助工程D. 计算机辅助工艺过程设计2.ERP是( B )的缩写ArrayA. 物料需求计划B. 企业资源计划C. 制造资源计划D. 集成制造技术3.下列说法那项是错误的( C )A. 文件的操作主要表现在两个方面,一个是查找,一个是排序。
B. 数据结构分为物理结构和逻辑结构。
C. CAD/CAM系统实际上就是软件。
D. 将隐藏线和隐藏面消除的过程就叫消隐。
4.CAD/CAM系统主要研究对象描述、系统分析、方案的优化、计算分析工艺设计仿真模拟、NC编程以及图形处理等。
它( B )A. 输入的是设计要求,输出的是设计方案。
B. 输入的是设计要求,输出的是制造加工信息。
C. 输入的是设计要求,输出的是图纸。
D. 输入的是设计要求,输出的是工艺流程。
5.建模技术将显示世界中的产品及相关信息转换为计算机内部能够处理、存储和管理的( B )表达方法。
A. 自动化B. 数字化C. 智能化D. 系统化6.CAD/CAM系统中软件分为几大类,他们是:( B )A. 系统软件、功能软件、应用软件B. 系统软件、支撑软件、应用软件。
复合材料期末复习资料

复合材料期末复习资料————————————————————————————————作者: ————————————————————————————————日期:复合材料C 复习第一章概论1. 复合材料的定义?复合材料是由两种或两种以上物理和化学性质不同的物质组合而成的一种多相固体材料。
三要素:基体(连续相)增强体(分散相)界面(基体起粘结作用并起传递应力和增韧作用)复合材料的特点:(明显界面、保留各组分固有物化特性、复合效应,可设计性)(嵌段聚合物、接枝共聚物、合金:是不是复合材料??)2、复合材料的命名f(纤维),w(晶须),p(颗粒) 比如: TiO2p/Al3. 复合材料的分类:1) 按基体材料类型分为:聚合物基复合材料;金属基复合材料;无机非金属基复合材料(陶瓷基复合材料)。
2)按增强材料分为:玻璃纤维增强复合材料;碳纤维增强复合材料;有机纤维增强复合材料;晶须增强复合材料;陶瓷颗粒增强复合材料。
3) 按用途分为:功能复合材料和结构复合材料。
结构复合材料主要用做承载力和此承载力结构,要求它质量轻、强度和刚度高,且能承受一定温度。
功能复合材料指具有除力学性能以外其他物理性能的复合材料,即具有各种电学性能、磁学性能、光学性能、声学性能、摩擦性能、阻尼性能以及化学分离性能等的复合材料。
第二章增强体1、增强体定义:结合在基体内、用以改进其力学等综合性能的高强度材料。
要求:1) 增强体能明显提高基体某种所需性能;2) 增强体具有良好的化学稳定性;3) 与基体有良好润湿性。
分类:f,w,p2、纤维类增强体特点:长径比较大;柔曲性;高强度。
❖玻璃纤维主要成分:SiO2性能:拉伸强度高;较强耐腐蚀;绝热性能好。
(玻璃纤维高强的原因(微裂纹)及影响因素(强度提升策略:减小直径、减少长度、降低含碱量,缩短存储时间、降低湿度等))分类:无碱(E玻璃)、有碱(A玻璃)制备: 坩埚法(制球和拉丝)、池窑法(熔融拉丝)。
大一期末C语言程序设计基础题库与总结复习资料

C语言题库第一章计算机语言经历发展阶段:机器语言、符号语言、高级语言程序结构有3种:顺序结构,选择结构,循环结构C语言的特点:允许直接访问物理地址。
【C语言中含有的位和指针运算,能够直接对内存地址进行访问。
】不是C语言的特点的是:能够编制出功能复杂的程序【所有程序都可以,不算特点】Main:主函数,是所有程序运行的入口、起点。
一个C语言程序必须只有一个main函数。
程序总是从main函数开始执行,main函数可以放任何位置,到main函数结束。
函数体由花括号括起来结束标志:returnreturn 0的作用是:当main函数执行结束前将整数0作为函数值返回到调用函数处return(z)的作用是:将z的值作为max的函数值返回给调用max 函数的函数。
只有通过return(z)才能把求出的z值作为函数值并返回调用它的main函数中C语言程序的结构:由一个或多个源程序(C语言编写的程序,也可以叫编译单位)文件组成(源程序文件中包含:预处理指令、全局声明、函数定义)函数是C程序的主要组成部分(也是基本单位),C语言由函数组成。
函数包括两部分:函数首部、函数体C语言本身不提供输入输出语句,输入输出的操作是有库函数scanf 和printf等函数来完成的。
程序应包含注释#define和printf都不是C语句C语言程序的运行经过:编辑(edit)、编译(compile)、连接(link)【C语言中是build】、执行(execute)。
C语言源程序文件的后缀是.cpp,经过编译之后,生成后缀为.obj 的目标文件,经连接生成后缀.exe的可执行文件C语言的储存类型包括register、extern、statis和auto基础知识6、用 C 语言编写的源文件经过编译,若没有产生编译错误,则系统将( C )。
A. 生成可执行目标文件B. 生成目标文件C. 输出运行结果D. 自动保存源文件运算优先级:!(非)>算数(如%)>关系>逻辑>赋值运算符(低)空语句:只有分号组成的语句,即一个分号。
C语言期末复习资料

《C语言》课程综合复习资料一、单项选择1. 若有如下语句: int *p1,*p2; 则其中int所指的是()A. p1的类型B. *p1和*p2的类型C. p2的类型D. p1和p2所能指向变量的类型2. 下列程序段的输出结果是() x=9; while(x>7) {printf(“*”);x--;}A. ****B. ***C. **D. *3. 下列变量的定义及赋值正确的是()A. int i=0;j;B. char c=”A”;C. double x,y,z; x=y=z=100;D. float a=b=100;4. 设有语句:int x=10; x = x -= x - x;,则执行语句后,x的值为()A. 30B. 20C. 10D. 405. 设有语句:float x=1,y; y=x 3/2; 则y的值是()A. 1B. 2C. 2.0D. 2.56. 设有如下定义和执行语句,其输出结果为()int a=3,b=3; a = --b + 1; printf(“%d %d”,a,b);A. 3 2B. 4 2C. 2 2D. 2 37. 设有两字符串“Beijing”、“China”分别存放在字符数组str1[10],str2[10]中,下面语句中能把“China”连接到“Beijing”之后的为()A. strcpy(str1,str2);B. strcpy(str1, “China”);C. strcat(str1,“China”)D. strcat(“Beijing”,str2);8. 设有定义语句:char str[][20]={""Hello"",""Beijing""},*p=str; 则printf(""%d\n"",strlen(p+20)); 输出结果是()A. 0B. 5C. 7D. 209. 设有定义int a[ ]={1,5,7,9,11,13},*p=a 3;则*(p-2),*(a 4)的值是()A. 5 11B. 1 9C. 5 9D. 有错误10. 设有定义:int x=0,y=1,z=1;则运行表达式:x=y >z--后,x,y,z的值分别是()A. 1,1,1B. 1,2,0C. 0,1,1D. 0,2,011. 设有定义:int x=12,n=5; 则表达式 x%=(n%2) 的值为()A. 0B. 1C. 2D. 312. 设有定义 int a=3,b=4,c=5; ,则以下表达式中,值为0的表达式是()A. a&&bB. a<=bC. a||b c&&b-cD. !((a<b)&&!c||1)13. 设有定义 int a[ ]={1,5,7,9,11,13}, *p=a 3; 则*(p-2) , *(a 4) 的值是()A. 5 11B. 1 9C. 5 9D. 有错误14. 设有定义 char *p=“abcde\0fghjik\0”; 则printf(“%d\n”,strlen(p));输出结果是()A. 12B. 15C. 6D. 515. 设有int x=11;则表达式(x *1/3)的值是()A. 3B. 4C. 11D. 1216. 设a=3,b=4,c=-5,则逻辑表达式:a || b c && b==c 的值是()A. 1B. 0C. 非0D. 语法错17. 若有以下定义:int a[10],*p=a; 则*(p+3)表示的是()A. 元素a[3]的地址B. 元素a[3]的值C. 元素a[4]的地址D. 元素a[4]的值18. 若有以下定义:char s[20]= "programming",*ps=s;则不能代表字符g的表达式是()A. ps 3B. s[3]C. ps[3]D. ps =3,*ps19. C语言中,函数返回值的类型是由()A. return语句中的表达式类型决定B. 调用函数的主调函数类型决定C. 调用函数时的临时类型决定D. 定义函数时所指定的函数类型决定20. C语言提供的合法关键字是()A. swicthB. chaC. CaseD. default二、读程序题1. "#include <stdio.h>void main(){ int a=4,x=3,y=2,z=1;printf(""%d\n"",(a<x ? a : z<y ? z : x));}"2. "#include <stdio.h>void main(){ int x=12,y=0;if(x>=0){ if(x>0) y=10; }else y=-10;printf(“y=%d\n”,y);}"3. "#include <stdio.h>void main(){ int k=1;switch(k){ case 0: printf(""A""); break;case 1: printf(""B"");case 2: printf(""I"");case 3: printf(""G""); break;default: printf(""E"");}}"4. "#include <stdio.h>#define S(x) x*xvoid main(){int a,k=3,m=1;a=S(k+m);printf(""%d"",a);}"5. "#include <stdio.h>int fun(int a, int b){ if(a>b) return(a);else return(b);}void main(){ int x=3, y=8, z=6, r;r=fun(fun(x,y), 2*z);printf(""%d\n"", r);}"6.#include <stdio.h&>void main(){ int k=4,n=0;for(;n<k;){ n++;if(n%3!=0) continue;k- -;}printf(""%d,%d\n"",k,n);}三、编程题1. 写一个判断素数的函数。
计算机基础大一第一学期期末复习

计算机基础大一第一学期期末复习计算机文化基础期末考试复习以下是咱们期末考试的复习题,希望大家认真学习;一、选择题1、第一台计算机ENIAC淡生于1946年,是电子管计算机;第二代是晶体管计算机;第三代是中小规模集成电路;第四代是大规模集成电路;2、计算机的应用领域主要有:科学计算;信息管理;实时控制;办公、生产自动化;人工智能,网络通信;电子商务;辅助设计(CAI);辅助设计(CAD);3、计算机的信息表示形式为二进制,它采用了冯。
诺依曼的思想原理,即以0 和1两个数字形式用于展现,“逢二进一”;它的基本信息单位为位,即一个二进制位。
常用的换算单位有:1B ===8bit; 1KB====1024B ;1MB====1024KB; 1GB===1024MB;1TB===1024GB;1个汉字===2B;4、二进制换算法则:将十进制转化为二进制时除二取佘;二进制转化为八进制时以三位为一组,三位的权重等于八进进中的一位权重,二进制转化为十六进制时以四位为一组; 5、对于字符的编码,普遍采用的是ASCII码,中文含义为美国标准信息交换码;被国际标准化组织ISO采纳,作用通用信息交换标准。
6、计算机的系统的组成由软件系统和硬件系统两部分组成;7、硬件系统包括运算器,控制器,存储器,输入,输出设备,控制器和运算器合成为中央处理器即CPU ,存储器主要有内存和外内之分;内存又分为只读存储器(ROM)和随机存储器(RAM),断电内容丢失的是RAM,外存主要有硬盘(GB),软盘(3。
5寸,1。
44MB),光盘(650MB左右),移动存储器优盘(MB),MP3(MB)等;8、软件指在硬件设备上运行的各种程序及其有关的资料。
主要有系统软件(操作系统、语言处理程序、数据库管理系统)和应用程序软件即实用程序(如WPS,OFFICE,PHOTOSHOP等)。
9、计算机性能的衡量指标有:10、计算机语言的发展经历了机器语言,汇编语言,高级语言;计算机能识别的语言是计算机语言; 11、显示器的分辩率是显示器一屏能显示的像素数目,是品价一台计算机好坏的主要指标。
c语言期末复习资料1

1.C 语言程序中可以对程序进行注释,注释部分必须用符号_ __括起来。
A、…{… 和‟}‟B、…[…和‟]‟C、“/*”和”*/”D、“*/”和”/*”2.下列运算符中,优先级最低的是___ __。
A、*B、!=C、+D、=3.若变量已正确定义,表达式(j=3, j++) 的值是_ ____ 。
A、3B、4C、5D、04.已知字符…a‟ 的ASCII码为97 ,执行下列语句的输出是__ ___。
printf ("%d, %c", ‟b‟, ‟b‟+1 ) ;A、98, bB、语句不合法C、98, 99D、98, c5._ ____是合法的用户自定义标识符。
A、b-bB、floatC、<fr>D、_isw6.若变量已正确定义并赋值,表达式_____不符合C语言语法。
A、a*b/c;B、3.14%2C、2, bD、a/b/c7.___ _是不正确的字符常量。
A、‟\n‟B、‟1‟C、"a"D、‟\101‟8.在C 程序中,用__ __表示逻辑值“真”。
A、1B、非0 的数C、非1 的数D、大于0 的数9. _____ _把x、y定义成float类型变量,并赋同一初值3.14。
A、float x, y=3.14;B、float x, y=2*3.14;C、float x=3.14, y=x=3.14;D、float x=y=3.14;10.设变量定义为“int a, b;”,执行下列语句时,输入____ _,则a和b的值都是10。
scanf("a=%d, b=%d",&a, &b);A、10 10B、10, 10C、a=10 b=10D、a=10, b=1011.C语言源程序文件经过编译连接之后生成一个后缀为__ ___的文件。
A.”.c”B.“.obj”C.“.exe”D.“.bas”C12.以下选项中不正确的整型常量是__ __。
C++计算机章节基础知识题

第0章基础1.一个可以运行的C源程序中应至少包含一个 main函数。
2.在一个C源程序中,程序总是从main 函数开始执行的。
3. 一个有效的算法不能无限循环运行。
4. 一个有效的算法可以0或多个输入。
5. 一个有效的算法可以一个或多个输出。
6.表示一个良好算法的基本单元主要采用3种基本结构:顺序结构、选择结构和循环结构。
7.“//”可以实现单行注释。
8. “/*……*/”可以实现块式注释9. 定义函数时函数首部最后不能有分号10.数据声明和语句最后必须有分号11. C语言区分大小写12.一个程序由一个或多个源程序文件组成13.函数是C程序的主要组成部分14.程序总是从main函数开始执行15.以下叙述中正确的是( C )A)C语言比其他语言高级B)C语言可以不用编译就能被计算机识别执行C)C语言以接近英语国家的自然语言和数学语言作为语言的表达形式D)C语言出现的最晚,具有其他语言的一切优点16.下面关于算法的描述中错误的是( B )。
A) 算法具有有效性B) 算法具有唯一性C)算法的每一步具有确切的含义,即确定性D) 算法具有有穷性17. C语言规定,在一个源程序中,main函数的位置( C )A)必须在最开始B)必须在系统调用的库函数的后面C)可以任意D)必须在最后18. 以下叙述不正确的是( D )A)一个C源程序可由一个或多个函数组成B)一个C源程序必须包含一个main函数C)C程序的基本组成单位是函数D)在C程序中,注释说明只能位于一条语句的后面19. 算法的有穷性是指( A )。
A)算法程序的运行时间是有限的B)算法程序所处理的数据量是有限的C)算法程序的长度是有限的 D)算法只能被有限的用户使用20. 算法是指为解决某个特定问题而采取的确定且有限的步骤,下面不属于算法的五个特性的是( B )A)有零个输入或多个输入B)高效性C)有穷性D)确定性21. 以下叙述中正确的是(C )。
A)用C程序实现的算法必须要有输入和输出操作B)用C程序实现的算法可以没有输出但必须要有输入C)用C程序实现的算法可以没有输入但必须要有输出D)用C程序实现的算法可以既没有输入也没有输出22.构成C语言程序的基本单位是( A )A函数B过程C子程序D子例程23. 以下叙述中正确的是( C )。
大学英语期末复习资料-附参考答案

大学英语(4)期末复习资料(附参考答案)一、语法(75题)Grammar: Choose the best choice to complete the sentences.1.I every week.A go swimmingB goes swimmingC went swimming2.I work yesterday.A doesn’t go toB didn’t go toC don’t go to3.my father phone me last night?A DoB DoesC Did4.What in their spare time?A do the students often readB the students often readC the students do often read5.I was reading the newspaper Joyce came over to chat.A at thenB whenC where6.I sleep well when I was younger.A don’t used toB didn’t used toC didn’t use to7.We everything together, but now we don’t.A use to doB used to doC used do8.There have been a lot of changes 1978.A sinceB fromC for9.Her brother in the army for three years.A have beenB has beenC was10.I haven’t paid DJ Richard .A sinceB alreadyC yetst year I often that library.A went toB go toC goes to12.anything wrong with the machine?A Are thereB Is thereC Do there13.Who gave you those flowers?A /B doC did14.I some drinks when I noticed this woman.A am makingB makeC was making15.Did you play basketball?A use toB used toC be used to16.She has just Shanghai.A went toB gone toC go to17.You borrow my bike tomorrow.A mustB canC should18.You go there.A don’t have toB need not toC don’t need19.The nights be cold.A areB shouldC will20.Hurry up, we’ll be late.A orB andC but21.I go to the party.A might notB not mightC mustn’t22.He be ill. He looks so pale.A canB mustC mustn’t23.I can’t promise you .A somethingB anythingC nothing24.Jim is Jack.A as tall thanB as taller asC as tall as25.He is boy in our class.A the tallestB the most tallC a tallest26.you don’t know the answer, ask me.A SinceB BecauseC If27.You smoke here.A mustn’tB needn’tC don’t28.Paris tonight. Look -- here’s the plane ticket.A I’m flying toB I fly toC I can fly to29.My car consumes gas than hers.A fewB lessC little30.Mary has more books her brother.A asB likeC than31.He is of the five brothers.A the youngerB the youngestC the most young32.If it rains, I stay at home.A willB mightC must33.My car outside the school yesterday.A is parkingB was parkC was parked34.I’ve bought a new house.A justB yetC really35.When we got there, the basketball match .A has already startedB had already startedC had already starting36.They were warmly by the local people.A welcomedB welcomeC welcoming37.If I you, I would refuse the money.A amB wasC were38.If you dropped the glass, it break.A willB wouldC can39.He told me that he me a special present.A will buyB would boughtC had bought40.This house last year.A was builtB is builtC was build41.the end of that year, Henry had collected more than a thousand foreign stamps.A OnB AtC By42.She said that she about her date.A was really excitedB was really excitingC is really excited43.Jenny a day’s work.A already has doneB has already doneC has done already44.The song was composed an 8-year-old boy.A withB atC by45.He said that he her the day before.A sawB have seenC had seen46.I met an old friend of mine .A on my way homeB on way homeC on my way to home47.He went ________.A to upstairsB upstairsC stair up48.He has an ________ jacket.A black old leatherB leather old blackC old black leather49.The film ________ I saw last night is about a young teacher.A whichB whoC what50.He is sorry ________ the news.A hearB to hearC that hear51.My grandpa is wearing a ________ belt.A red long plasticB long plastic redC long red plastic52.We have friends all over ________ world.A theB aC /53.I asked him how he liked ________ Paris.A aB theC /54.There must be life out there ________.A anywhereB somewhereC everywhere55.I hate ________bright colours like red and yellow.A wearingB to wearC wear56.The ________have a lot of time to do their own research work.A there studentsB students thereC there are students57.I ________him singing.A have never heardB never have heardC have heard never58.The old man walked home________.A slowB slowerC slowly59.He often comes to school ________.A lateB latelyC in late60.The girl ________answered the phone was polite enough.A whichB thatC what61.Your shoes need ________.A polishB polishedC polishing62.________ abroad can be very exciting.A TravellingB TravelC Travelled63.I enjoy ________with you.A workB to workC working64.I found my ________ paintings.A two first small oilB first two small oilC first small two oil65.I considered ________ better not to go.A itB thatC /66.I would like ________ more money on clothes.A spendingB to spendC spend67.She has two cats. ________big cat is white, and ________ small one is black.A the, aB A, theC The, the68.________ is power.A The knowledgeB KnowledgeC A knowledge69.We ________ visit our friends in Germany in April. They invited us last week.A are going toB willC are about to70.The weather is________ than it was yesterday.A more badB more worseC worse71.It is one of the best concerts I________.A went toB have ever been toC had gone to72.China is no longer what it________.A used to beB was used to beingC used to being73.The workers are busy________models for the exhibition.A to makeB with makingC making74.________you change your mind, I won’t be able to help you.A WhenB UnlessC While75.I have taken many photos. I’m going to get the film________.A developedB developingC to be developed二、完型填空(7篇)Cloze: Read the article and choose the best choice to fill the gaps.1.From: U2L2 P23Close EncountersThese days, you can find love in all kinds of places. We talked to four couples from around the world who met their partner in a memorable way.TammyI was very sceptical about meeting people ____1____ the Internet. But one day I was ____2____ the net and decided to go into a chat room. It was quite boring until a guy ____3____ Brad came in. We chatted for a long time and then ____4____ photos. It was difficult because we were both going out with someone at the time and we were living in ____5____ states, but eventually we arranged to meet. And now we’re together!AlbertI live in an old people’s home and I really thought I was ____6____ old to meet anybody special. I wasn’t looking ____7____ love, but I suppose I needed a friend. One day, I was ____8____ the newspaper in the garden when Joyce came over to have a chat. We talked and talked, day after day, and we became very ____9____. Now, we do everything together. I have one regret –that I didn’t ____10____ Joyce years ago!1 A on B in C through2 A surf B surfed C surfing3 A call B called C calling4 A exchanged B charged C changed5 A the same B other C different6 A so B too C very7 A at B for C after8 A reading B making C writing9 A sleepy B tired C close10 A meet B love C marryKey: ACBAC BBACA2.From: U2L2 P23Close EncountersThese days, you can find love in all kinds of places. We talked to four couples from around the world who mettheir partner in a memorable way.PetraIt ____1____ one night at our local nightclub. I was dancing, and suddenly I ____2____ the feeling that someone was watching me. I looked around and saw a boy on the other side of the room staring at me. I ____3____ to be brave and walked over to him. Hans was very shy but we had a drink and started talking. We just clicked and we quickly became friends.RicardoIt was New Year’s Eve and I ___4____ some people around to my house to celebrate. I planned a quiet party but my friends brought other friends and by twelve o’clock there were lots of people. I was ____5____ some drinks in the kitchen when I noticed this woman on her ____6____. She didn’t seem to know anybody, so I ____7____ over to her and ____8____ myself. She said, “So you’re not Antonio, then?!”She was at the wrong party–she had made a____9____ with the address! I asked her to stay and we got on really ____10____…and now we’re together.1 A came B happened C went2 A had B felt C sensed3 A told B liked C decided4 A invited B loved C asking5 A washing B making C playing6 A side B self C own7 A ran B went C leaned8 A introduced B asked C talked9 A fuss B wrong C mistake10 A good B well C fineKey: BACAB CBACB3.From: U5L3 P7315 months that can change your lifeTeachers and students agree – a gap year is a unique experience that can ____1____ your life forever. Gap years usually____2____when a student leaves schools in June and last ____3____ they start higher education in October of the following year. Prince William’s decision to have a gap year in Patagonia was typical of ____4____ people in the UK – they take a____5____ from studying and see some of the world ____6____ going on to university or____7____. It’s ____8____ opportunity to enjoy a bit of adventure, travel, maybe ____9____ some work experience or spend some time ____10____ other people.1 A change B live C have2 A finish B begin C continue3 A so that B but C until4 A young B old C rich5 A breath B nap C break6 A when B before C after7 A college B work C school8 A a B / C an9 A gain B lose C won10 A help B helping C helpedKey: ABCAC BACAB4.From: U8L2 P119Paparazzi Pirate: Blog 139I had just woken up when I ____1____a call from Pepe at La Gaviota restaurant. He told me that some big names were coming for lunch. I left my house as soon as I had phoned my editor to check what shots he wanted. I arrived at 11 am and ____2____ behind the bushes with my camera.I had been there ____3____ about two hours before an interesting car arrived. I saw George Clooney and his new girlfriend get out.____4____, I coul dn’t get a good photo. Then, suddenly, I realised that they were going to the back door of the restaurant. I got on my motorbike and____5____their limousine. This time, I took a ____6____ shot of Clooney; he even smiled at me! I put the film in my pocket.Just then Clooney’s bodyguard saw me. He wanted the film. We fought and I just managed to ____7____. I rushed to the office on my bike, but when I arrived andsearched____8____ the film, I realised that it had ____9____out of my pocket during the fight. I felt really ____10____!1 A accepted B dialed C got2 A hid B hidden C hides3 A with B for C till4 A Furthermore B Besides C Unfortunately5 A ran B chased C rushed6 A perfect B bad C ugly7 A escape B win C defeat8 A on B by C for9 A hopped B fallen C escaped10 A good B relaxed C stupidKey: CABCB AACBC5.From: U12L2 P180THE YOUNG AND ANGRY: in their own wordsA Tree DwellerNoah Rose, 29, is living in a tree house to protest about a new road ____1____ the local council is planning to build.“Sometimes you can get a bit bored of ____2____ in a tree house. I mean, you don’t have any of the basic things that you’re used to. I’m here because I really feel that th is road should not be ____3____. It will just add to pollution and ____4____ some beautiful countryside. I know we’ll succeed ____5____ the end–I’m sure we can beat the Department of Transport. Who needs more roads anyway?”A SquatterNancy Barrett, 23, lives in a squat in New Cross Road. The police want to evict her and other squatters from the houses in the area.“We have tied ourselves ____6____ the house, so the police can’t move us out. They’ve got no right. This house has been empty ____7____ years and nobody owns it. We live here peacefully and don’t do any ____8____ to anyone. We don’t believe ____9____ capitalism or consumerism, and that’s why this protest is important. A home is a home and you shouldn’t have to be grateful to the banks for that. ____10____happens, I know we’ll have to leave in the end. It’s depressing but that’s how it is –the police always win.”1 A what B who C which2 A living B live C to live3 A build B built C building4 A destroy B protect C love5 A by B in C at6 A with B on C to7 A in B for C by8 A harm B good C use9 A on B at C in10 A Whatever B However C WhoeverKey: CABAB CBACA6.From: U12L3 P1842050 – A Day in the Life of Citizen KYZ606 and his Pet Computer DanielFriday8:00 When I wake up, my pet computer, Daniel, smiles at me and says “Good morning”. He makes me a coffee and chooses my “look” for the day.9:00 At the office again. I want sunshine today so Daniel changes the lighting and air conditioning to create a ____1____day. It’s great here, because I don’t have to think –the computers do everything. While Daniel organizes my schedule, I talk to friends ____2____my mobile videophone.11:30 At the gym. My computer knows exactly ____3____I need to do. I don’t like doing so ____4____exercise, but Daniel says I’ll have a heart attack at the age of 53 if I don’t.13:00 Lunch in the office restaurant. We press some ____5____on the food-ordering machine, and the pills arrive quickly through a hole in the table. Everything tastes really good today.13:30 Back in the office, there’s nothing to do so I take a ____6____. Daniel will wake me up when I’ve had enough sleep.16:00Daniel has woken me up, but there’s no work to do so I do a bit of ____7____online. I love shopping.Daniel helps me find a shirt that will look good at the party tonight. He really knows what I like.19:00 Back at home, I watch a football match, although it’s not very exciting ____8____Daniel tells me the result before the end. He does that with films as well – I get really annoyed with him.21:00 Party in full swing. As soon as I arrive, Daniel chooses me a partner ____9____will be compatible. She seems very nice. I order another whisky and a red warning light goes on – I am drinking too much again!23:00 Time ____10____bed. Daniel prepares my pyjamas and my dreams for the night. I think I would prefer to dream on my own, but anyway… It’s been a good day… I think!1 A rainy B sunny C cloudy2 A on B in C through3 A which B that C what4 A much B many C more5 A cards B keys C buttons6 A nap B walk C shower7 A chatting B shopping C looking8 A so that B because C however9 A which B what C who10 A for B to C withKey: BACAC ABBCA7.From: U1L2 P10London: Melting Pot of CulturesA ChinaChinese people first came to Britain ____1____ 1885. The first arrivals were mostly seamen ____2____ worked on steamships. In the 1950s, many Chinese people settled in the central Soho area of London. This area is ____3____ Chinatown. Here, you can experience a taste of China by ____4____ in London’s best Chinese ____5____ and shopping for Chinese vegetables, herbal medicines and gifts.B The CaribbeanDuring the 1950s, people from the Caribbean islands ____6____ in London to start a new life. Their reggae music, steel drums and culture ____7____ all now part of the capital’s atmosphere, especially duri ng the Notting Hill Carnival, Europe’s ____8____ and most vibrant street party. When does it ____9____ place? You can catch it every year at the end of August. One of the ____10____ of the Caribbean community is in Brixton, in the south of London.1 A on B at C in2 A whom B who C whose3 A called B call C calling4 A eating B eat C to eat5 A hotels B bars C restaurants6 A got B arrived C reached7 A is B will be C are8 A largest B smallest C newest9 A make B take C give10 A tents B cents C centresKey: CBAAC BCABC三、阅读理解(14篇)(1)阅读判断题(7篇)Reading: Read the article and judge whether the following sentences are true (T) or false (F).1.From: U1L1 P6ProfilesCarolinaHi, I’m Carolina and I’m 21 years old. I live in Berlin, but I was born in the south of Italy. We moved here from Italy when I was 14 because of my father’s work. I’m half German, half Italian. I started working in the family business a few years ago – we have a jeweller’s shop. I work in the shop every afternoon except Sundays, but it’s a bit boring. The city is OK but I never have time to enjoy it – everything is so hectic. I often miss Italy.RashidMy name’s Rashid. I’m 24 and I live in London. I’m Ind ian, but I was born here in the UK. My parents came here from Bombay (we call it Mumbai now) at the end of the 1960s. London’s a great place to be for me because Istudy architecture and there are lots of interesting buildings around. Every day I see somet hing new. I don’t want to live anywhere else.LindaMy name’s Linda. I’m 25 and live in a small town outside Vancouver. My mother is Spanish and my father comes from Lagos in Nigeria. We speak English, French and Spanish at home. I work as a teacher in th e local school. It’s a great job but very tiring because I get up very early every morning. Before, I worked as a secretary –I didn’t like it at all! I really like the town I live in, although it’s very cold in winter. Cities like Vancouver are just too b ig for me.1 Everybody’s parents have different nationalities.2 Everybody likes cities.3 Linda likes her job.4 Carolina is the most positive about her city.5 Rashid was born in Bombay.Key: FFTFF2.From: U3L3 P42Rat race rebelsMost of us are trapped in a nine-to-five office routine and many of us would like to escape. We interviewed three people who have said “No!” to this rat race…FionaAfter university, I was on the dole for a few months. I didn’t have any money, so I was really pleased to get an office job… but it was very boring! I gave it up and went to do voluntary work for the VSO – V oluntary Service Overseas – in Rwanda. I teach old people and children to read and write. It’s not the most comfortable of jobs but it’s great to be doing something of real use for once.AndyI used to be a freelance news journalist. It was very stressful and I had to travel a lot. I applied for loads of other jobs with no success, so I started to think about my real interest –football! Now, I work from home and write football articles for press agencies around the world. It’s a full-time job but I have much more free time. I’m my own boss and I can get up when I want!EmmaI used to be a teacher and I worked 40 hours a week. Then, I saw the movie American Beauty and thought I could change my life too! I did a course in acupuncture and shiatsu massage. I took four years to get qualified but now I have set up my own business. Shiatsu is very popular these days because people are so stressed and you can earn quite good money.1 Fiona didn’t have a job for a while.2 Andy has turned an interest into a profession.3 Fiona has her own company.4 Fiona feels she is doing something useful.5 Andy was influenced by a film that he saw.Key: TTFTF3.From: U6L2 P71Your Weekend in Lisbon with Sunshine ToursCongratulations on booking your holiday with Sunshine Tours!!Here’s your travel itinerary for the long weekend. THURSDAY 18th JuneA Sunshine Tours rep will meet you at Lisbon airport and a coach will take you to your hotel.FRIDAY 19th JuneIn the morning,we will take one of the city’s famous yellow trams up to the Castelo de São Jorge, with fabulous views over the city. The afternoon is free for you to explore the Baixa district with its interesting shops and cafés. In the evening, we will go to the Bairro Alto area for dinner and to hear the wonderfully melancholy fado music. SATURDAY 20th JuneA day of contrasts. In the morning, a trip to the oldest neighbourhood, Alfama. Its little cobbled streets arecharming but it is also one of the poorest parts of the city. We will have lunch in the central Praça do Comércio and then take the metro to the modern Parque das Nações — the site of the Expo, which has some stunning architecture. In the evening, you are free to enjoy whatever part of the city you wish.SUNDAY 21st JuneA coach will take us out of the city to visit Sintra, summer residence of the kings of Portugal. Here, we will see the breathtaking Palácio Nacional and walk around Sintra’s beautiful woods and parks. On our way back, we will stop at Cascais, just half an hour from the capital. This is a real Portuguese beach resort, full of local people and crammed with restaurants, beach cafés and discos. After a relaxing dinner on the beach, the coach will take us back to the hotel. Our return flight leaves early on Monday morning.1 There is nothing organized on the Friday afternoon.2 On Saturday afternoon, you will visit an old part of the city.3 Cascais is popular with Portuguese people.4 You will spend Sunday evening outside Lisbon.5 You are going to return on Sunday night.Key: TFTTF4.From: U6L2 P85ChocoholicsEverybody loves chocolate. A cup of cocoa before going to bed or a Mars bar on the bus – the British are obsessed with it. The average Briton eats 10kg of chocolate a year. Women eat far more chocolate than men, an amazing 67% of total chocolate consumption. And the most popular snack is KitKat – fifty are eaten every second in the UK.Chocoholics are people with a chocolate obsession. But are they addicts? Not according to recent research. This shows that chocolate is not as addictive as coffee – in fact,there is no proof that chocolate creates addiction at all. And it’s a lot better for you than we thought. Some scientists say that it releases the same chemicals that your body produces when you are in love. Now that can’t be a bad thing!Some more good news –it doesn’t raise your cholesterol level or give you acne, as people believe, and it can even be good for your teeth! It does, however, contain caffeine and is bad if you get headaches. So the least sensible time to eat it is at night.The British lo ve chocolate but they are not as obsessed as the Swiss. The Swiss are officially the world’ greatest chocolate eaters – but then Swiss chocolate is the best!1Women buy less chocolate than men.2There is evidence that chocolate is addictive.3Chocolate contains caffeine.4You should avoid chocolate if you suffer from migraines.5The world’s greatest chocolate eaters are the British.Key: FFTTF5.From: U8L3 P121Found Safe and SoundThe monkey who escaped from Bristol Zoo last weekend was discovered by school children yesterday. Police say that the animal, who was found in a school playground, was fine but a little hungry. The zoo admitted that it needed to improve its security.Discovered…Naked and DrunkHollywood resident Helen Hicks was stopped by police early on Sunday morning after dancing around her neighbourhood with no clothes on. Hicks has drunk half a bottle of vodka after an argument with her rock guitarist boyfriend Johnny Hedges. A friend says that Ms Hicks was suffering depression.HospitalisedLion tamer Sergei Ivanov was seriously injured by his lion, Sheba, during last night’s performance of the Moscow Circus. Ivanov has worked in the circus for over 25 years. He was taken to Springfields General Hospital last night. Doctors say that he is lucky to be alive.Caught on CameraSuper-rich male model Justin Orlando’s love affair with British pop singer Ross Curtis was exposed this week. Thetwo men were photographed together in a London restaurant. Orlando, who has never tried to hide his sexuality, said that he was very happy with his new partner.1 The monkey was found by school children.2 The zoo said they were responsible for the monkey’s escape.3 Helen took her clothes off as a joke.4 Sergei hadn’t had much experience with animals.5 Justin wanted to hide his sexuality.Key: TTFFF6.From: U9L1 P132Digital NativesDavid is not very comfortable with new technology and he does not have many gadgets. Lucy loves new technology. She owns a games console, an MP3 player, and a mobile phone with a built-in digital camera. David is a teacher. Lucy is his student.Like Lucy, many children grow up using computers almost every day and often know more about technology than adults. Educator Marc Prensky calls children like Lucy “digital natives”. Digital natives can quickly learn how to use new gadgets and new software, while non-digital natives spend a lot of time reading manuals and worrying about computer viruses. In fact, many parents try to save time by asking their children to teach them how to use new technology!The divide between digital natives and non-digital natives can cause problems at school because students and teachers grow up with very different ideas about technology. Many teachers think that playing computer games is a waste of time and that technology has made children unable to concentrate. However, many students think their classes are slow and boring, and want to use computers to study.Prensky believes that digital natives have learned a lot from technology, but that they learn things in a different way. For example, reading a website is different from reading a book, so digital natives are good at finding the information they need and choosing what they want to read. So perhaps teachers need to change the way they teach and use more technology in class – because the number of digital natives will keep increasing!1 David is a digital native.2 Marc Prensky is interested in teaching with technology.3 Digital natives are comfortable using laptops and flash drives.4 Many teachers think computer games are only for having fun or killing time.5 People read books and websites in the same way.Key: FTTTF7.From: U10L2 P153SpanglishIn which city can you read signs like “Aparca your car aquí” or “Cuidado con los pickpockets”? Travelguide investigates.1.2 million Hispanics live in the Big Apple and one in five New Yorkers speaks Spanish at home. In the last ten years, the Hispanic population has grown by 400 000. This reflects the enormous increase in the Hispanic population in the States. There are now 42 million Hispanics resident in the USA, representing 15% of the total population.There is a new language, SPANGLISH – a strange mixture of Spanish and English – which is invading the city. The New York Times recently said that it had become the city’s third official language. Its use is colloquial and often limited to short sentences and signs. Many New Yorkers now wear socketines on their feet, drop something on the carpeta, shop for grocerias and have cornfley(“cornflakes”) for breakfast.Norma Rodríguez, a 45-year-old Cuban living in Washington Heights, says it forms a part of her life now: “Sometimes, you don’t realize that you’re mixing the two languages. You just hear them both all the time and find that you’re inventing new words.” Other people, however, are fighting against this new street language. Bu sinessman Juan Cortés sees it as a sign that the Spanish language is being destroyed. “It’s difficult, but I try not to speak it –it feels vulgar to me.”Meanwhile, a surprising number of academics have spoken in favour of Spanglish. JoséMaría Ruiz, from NY。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
1、面向对象相关概念:类:具有相同属性和行为的对象集合,把数据和操作封装在一起对象:数据+操作。
面向对象特征:抽象,封装,继承,多态2、输入输出:输入cin>>a>>b;输入不能有endl。
输出cout<<a<<b<<endl;3、const修饰符:●指向常量的指针:如const char *p=”abcd”;不允许改变指针所指的常量,如p[3]=’x’是错误的,但是可以改变指针p的值p=“mn”;是对的。
●常指针:char *const p =“abcd”;指针本身是常量,不能移动,但是所指内容为变量,可以更改,如p[3]=’x’是对的。
●常数据成员,常成员函数,常对象:在类中声明的数据或函数可以是常量,对于常数据成员要用初始化列表初始值,在C++类中,const关键字可以修饰对象和成员函数,const对象不能被修改,一个常对象只能调用它的常成员函数,不能调用普通成员函数。
常成员函数格式:类型说明符函数名(参数表)const;常成员函数可以参加重载。
常成员函数不能更新对象的数据成员,也不能调用该类中的普通成员函数,const成员函数不能修改数据成员。
4、内联函数:在函数说明前冠以关键字inline,目的是消除函数调用时的系统开销,提高运行速度。
注意:内联函数体内不能有循环语句和switch语句。
内联函数的声明必须出现在内联函数第一次被调用之前。
类结构中所有在类说明体内定义的函数都是内联函数。
5、带有缺省参数值的函数:在说明函数原型时,可以给一个或多个形参指定缺省值,调用时如给出实参,则采用实参值,否则采用预先给出的默认形参值。
如某一个类point的构造函数原型为point(int x=1, int y=0);则参数x和y的缺省值为1和0.注意:在函数原型中,所有缺省值的参数都必须从右往左缺省,在函数调用时从左往右将实参与形参结合,如point(int x=1, int y=0) {X=x;Y=y;},那么执行point p(3)之后p的X和Y值分别为3,0.6、函数重载:C++允许功能相近的函数在相同的作用域内以相同函数名声明,从而形成重载。
注意:重载函数的形参必须不同: 个数不同或类型不同。
编译程序将根据实参和形参的类型及个数的最佳匹配来选择调用哪一个函数。
例:void add(int m, int n){ cout<<”two integer numbers m+n=”<<m+n<<endl; }void add(float x,float y){ cout<<”two float numbers m+n=”<< m+n<<endl; }int i=1,j=2;float f=1.0,d=2.0;add(i,j);add(f,d);则前者调用第一个函数,后者调用第二个函数输出two integer numbers m+n=3two float numbers m+n=3.07、引用:引用(&)是标识符的别名,例如:int i;int &ri=i; //建立一个int型的引用ri,并将其初始化为变量i的一个别名。
注意:声明一个引用时,必须同时对它进行初始化,使它指向一个已存在的对象,不能声明完成后再赋值,如 int i;int &ri;//错误ri=i;一旦一个引用被初始化后,就不能改为指向其它对象。
如:int i,j;int &ri=i;ri=&j;//错误引用可以作为形参作为传地址调用,效果和指针一样。
void s a, int& b) {...}引用与地址符的区别:引用运算符仅在声明是带有引用运算符&,以后就像使用普通变量一样,其他场合使用&都是地址操作符8、作用域标识符(::)如果希望在局部变量的作用域内使用同名的全局变量,在该变量前加上::,如::a代表全局变量。
9、new和delete运算符new用来内存分配,最基本格式为:指针变量=new 类型名;该语句在程序运行时从自由存储区中为程序分配一类型名字节大小空间,该空间首地址被存于指针变量中。
运算符delete用于释放new分配的存储空间,基本格式:delete 指针名;说明:●可以用new将分配的对象初始化,new和delete都可以重载。
●new分配的空间使用结束后应该也只能用delete显式释放,否则将不能回收而变成死空间●使用new为数组动态分配内存:指针变量=new 类型名[下标值];如int *p=newint[10];释放时:delete []指针变量名;如delete []p;●new可以为简单变量分配内存时同时进行初始化,指针变量=new 类型名(初始化列表);如int *p=new int(10);10、类是一种用户自定义类型,声明形式:class 类名称{public:公有成员(外部接口)private:私有成员protected:保护型成员};类成员中缺省访问方式为私有●公有类型成员:在关键字public后面声明,它们是类与外部的接口,任何外部函数都可以访问公有类型数据和函数。
●私有类型成员:在关键字private后面声明,只允许本类中的函数访问,而类外部的任何函数都不能访问。
如果紧跟在类名称的后面声明私有成员,则关键字private可以省略。
●保护类型:在类的定义中,说明为protected的数据成员称为保护成员。
保护数据成员具有双重作用:对于其派生类而言,是公有的,而对于其外部的程序而言,是私有的●类的成员:成员数据与一般的变量声明相同,但需要将它放在类的声明体中。
成员函数在类中说明原形,可以在类外给出函数体实现,并在函数名前使用类名加以限定。
也可以直接在类中给出函数体,形成内联成员函数。
●类的对象是该类的某一特定实体,即类类型的变量。
声明形式:类名对象名;例:Clock myClock;●类中成员的访问方式:类中成员互访:直接使用成员名类外访问:使用“对象名.成员名”或“对象指针名->成员名“方式访问 public 属性的成员11、构造函数构造函数的作用是在对象被创建时使用特定的值构造对象,或者说将对象初始化为一个特定的状态。
特点:●在对象创建时或new类名时由系统自动调用。
●如果程序中未声明,则系统自动产生出一个默认形式的构造函数,只有程序中定义有构造函数,系统不再自动生成缺省的构造函数缺省构造函数类名::缺省构造函数名(){}●函数名必须与类名相同●不能指定函数返回类型●参数可以有,也可以无,参数可以带默认形参值,所以一个类可以有多个构造函数,从而构造函数可以重载。
如有一个类A,当执行语句A a;时将自动调用该类的无参构造函数或缺省的构造函数或带默认形参值的构造函数,但无参构造函数和带默认形参值的构造函数二者同时出现容易出现调用时引起二义性●允许是内联函数利用构造函数创建对象有两种方法:●用构造函数之间创建对象:类名对象名(实参表);如point p(1,2);●利用构造函数创建对象时,通过指针和new来实现:类名 *指针变量=new 类名(实参表);如A *p=new A(1,2);注意类A声明对象指针并不调用构造函数,而是通过new创建临时对象调用构造函数,所以该语句只调用构造函数1次12、拷贝构造函数拷贝构造函数是一种特殊的构造函数,其形参为本类的对象引用,作用是用已经存在的对象初始化另一个同类的新对象。
类名(类名 &对象名);//拷贝构造函数如类A拷贝构造函数为: A (A &x);拷贝构造函数特点:●也是构造函数,所以其函数名与类名相同,没有返回值●只有一个参数,并且是本类的对象引用,所以一个类只能有一个,不能重载●每一个类都有一个拷贝构造函数,如果没有定义,系统会自动生成一个缺省的调用拷贝构造函数3种情况:●当用类的一个对象去初始化该类的另一个对象时系统自动调用拷贝构造函数实现拷贝赋值。
●若函数的形参为类对象,调用函数时,实参赋值给形参,系统自动调用拷贝构造函数。
●当函数的返回值是类对象时,系统自动调用拷贝构造函数。
深拷贝和浅拷贝:缺省的拷贝构造函数所实现的数据成员逐一赋值就是浅拷贝,当类中有指针时,需要自定义拷贝构造函数,谓深拷贝。
13、析构函数完成对象被删除前的一些清理工作。
特点:●析构函数与构造函数名相同,但它前面必须加一个波浪号~●析构函数没有返回值●析构函数没有参数,所以一个类中只能有一个析构函数,所以析构函数不能重载●当撤销对象时,或delete对象指针编译系统自动调用析构函数●如果没有定义析构函数,系统自动生成一个缺省的析构函数类名::~缺省析构函数名(){}14、成员初始化列表在声明类时,不能在数据成员的声明中对数据成员进行初始化,一般在构造函数中用赋值语句进行,但对于内嵌的对象、常量、引用数据成员需要在构造函数的成员初始化列表中进行。
带有成员初始化列表的构造函数一般格式:类名::构造函数名(参数表):(成员初始化列表){。
}15、this指针隐含于每一个类的成员函数中的特殊指针。
16、对象数组:类名数组名[下标值];该数组中每个元素都是对象,都会自动调用构造函数,当数组中每一个对象被删除时,系统都要调用一次析构函数。
访问方法:数组名[下标].成员名17、对象指针:类名 *对象指针名;定义对象指针不会调用构造函数利用对象指针可以访问单个对象成员,如point *p,ob;p=&ob;p->show();或(*p).show(); 也可以用对象指针访问对象数组,对象可以作为函数参数,对象指针也可以18、指向类成员的指针:通过指向成员的指针只能访问公有成员指向类的非静态成员的指针●指向公有数据成员的指针:类型说明符类名::*数据成员指针名;说明指针应该指向哪个成员:指针名=&类名::数据成员名;通过对象名(或对象指针)与成员指针结合来访问数据成员:对象名.* 类成员指针名或:对象指针名->*类成员指针名●声明指向公有函数成员的指针:类型说明符 (类名::*指针名)(参数表);初始化:指针名=类名::函数成员名;通过对象名(或对象指针)与成员指针结合来访问函数成员:(对象名.* 类成员指针名)(参数表)或:(对象指针名->*类成员指针名)(参数表)指向类的静态成员的指针●对类的静态成员的访问不依赖于对象,可以用普通的指针来指向和访问静态成员19、静态成员●静态数据成员●用关键字static声明,该类的所有对象维护该成员的同一个拷贝,必须在类外定义和初始化,用(::)来指明所属的类。