收藏 分享(赏)

C++语言程序设计试题试题及答案.doc

上传人:cjc2202537 文档编号:7004249 上传时间:2019-04-30 格式:DOC 页数:49 大小:33.60KB
下载 相关 举报
C++语言程序设计试题试题及答案.doc_第1页
第1页 / 共49页
C++语言程序设计试题试题及答案.doc_第2页
第2页 / 共49页
C++语言程序设计试题试题及答案.doc_第3页
第3页 / 共49页
C++语言程序设计试题试题及答案.doc_第4页
第4页 / 共49页
C++语言程序设计试题试题及答案.doc_第5页
第5页 / 共49页
点击查看更多>>
资源描述

1、C ,C+(120)1. Cmain( C )A. B. C. D. 2. ( B )A. +1e+1 5e-9.4 03e2B. -.60 12e-4 -8e5C. 123e 1.2e-.4 +2e-1D. -e3 .8e-4 5.e-03. a=-14,b=3, a#define F(y) 8.19-y#define PRINT(a) printf(“%d“,(int)(a)void main(void)int x=2;PRINT(x*F(3);A. 10 B. 13 C. 11 D. 11. ( C )A. A. void main(void)unionint n;float x; co

2、mm=1;printf(“%d“,comm.n);B. B. void main(void)unionint n;float x; comm=12.5;printf(“%f“,comm.x);C. C. void main(void)unionfloat x;int n; comm=12.5printf(“%f“,comm.x);D. D. void main(void)unionint n;float x; comm=5;printf(“%d“, comm.n);12. int a=1,*p= float b=2.0; char c=A; ( A)A. p+; B. a-; C. b+; D

3、. c-;13. scanfa-( B )main()int *p,*q,a,b;p=printf(“input a:“);scanf(“%d“,*p);-A. *ppB. *pa aC. *ppD. *pp14. numabcintnum=(a=4,b=16,c=32);num( C )A. 4 B. 16 C. 32 D. 5215. ,a1,a2,c1,c210,20,AB,( C ),(: _ )int al,a2,char c1,c2;scanf(“%d%c%d%c“,A. 10A_20_B B. 10_A_20_B C. 10A20B D. 10A20_B16. int a10;

4、a(C )A. a10 B. a3.5 C. a5-3 D. a-117. C, ;( A)A. B. C. D. 18. a( C )A. in a10=(0,0.0,0,0);B. int a10=; C. int a0;D. int a10=10*1;19. ( C )x=-1;dox=x*x;while(! x);A. - B. -C. - D. 20. do-while-( B )A. do-while-B. do-while-dowhilewhile()C. do-while-while(“)D. do-while-(115)1. CT2. T3. whiledo-while-T4

5、. -continue-F5. 01T6. int a34=0a000 T7. T8. T9. 0F10. F11. F12. T13. 14. i+i15. (15)1. if a0,( ABC ).Aa=a void main(void)float x,y,z,sum;scanf(“%f%f%“,sum=fun1( )+ fun1 ( );printf(“sum=%fn“,sum);float fun1(float a,float b)float num;num=a/b;return num;(220)1. :/6=1/(11)+1/(22)+1/(33)+., 10e-6#include

6、 #include void main(void)long i=1; pi=0;while (i*i1)#includeint age(int n)int c;if (n=1) c=10;else c= ;return c;4. void main(void)int year,yes;scanf(“%d“,if (year%400=0) yes=1;else if ( ) yes=1;else ;if(yes) printf(“%d is “,year);else printf(“%d is not “,year);printf(“a leap year.n“);5. : ,void main

7、(void)int x,y,z,c;scanf(“%d %d %d“,if ( ) c=y;y=z;z=c;if ( ) c=x;x=z;z=c;if ( ) c=x;x=y;y=c;printf(“%d,%d,%d“,x,y,z);(120)1. Cfloat( );double( )1A) c B) C) W D) 2C+:A) WHILE B) user C) _1var D) 9stars3_int i=0;while(i#include class CRectprivate:char color10;int left;int top;int length;int width;publ

8、ic:CRect();CRect(char *c, int t, int lef, int len, int wid);void SetColor(char *c);void SetSize(int l=100, int w=100);void Move(int t,int l);void Draw();CRect:CRect()strcpy(color, “Black“);top = 0;left = 0;length = 0;width = 0;CRect:CRect(char *c, int t, int lef, int len, int wid)strcpy(color, c);to

9、p = t;left = lef;length = len;width = wid;void CRect:SetColor(char *c)strcpy(color, c);void CRect:SetSize(int l, int w)length=l;width = w;void CRect:Move(int t,int l)top = t;left = l;void CRect:Draw()cout class Aint x,y;public:A()x=0;y=0;A(int a, int b)x=a;y=b;A()if(x=y)cout class Aprivate:int n;pub

10、lic:A(int i)n=i;operator +()n+;operator +(int )n+=2;void Display()cout int func1(int n);int func2(int n);void main()int sum;sum = func2(5);cout #include class Aprivate:_(1)_protected:_(2)_public:A(int a, int b, int c)X=a;Y=b;Z=c;int GetX()return X;int GetY()return Y;int GetZ()return Z;class B _(3)_p

11、rivate:int K;public:B(int a, int b, int c, int d)_(4)_K=d;void Show()cout #include void func1(double s)int i,k;for(k=2,i=0; imain()int i,t=1,s=0;for(i=1;ilong sub(int num)int i;long subsum=1;for(i=1;iclass Basepublic:void WhoAmI()cout “Class Bass“ endl;virtual void Who()cout “Class Bass“ endl;class Derived:public Basepublic:void WhoAmI()cout “Class Derived“ endl;void Who()cout “Class Derived“ endl;void main()Base *p;

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

当前位置:首页 > 企业管理 > 管理学资料

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报