云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > 全国2011年10月自学考试C加加程序设计试题和答案

全国2011年10月自学考试C加加程序设计试题和答案

  • 62 次阅读
  • 3 次下载
  • 2025/5/25 4:46:57

http://www.zikao5.com 我自考网整理

a. f1(1.6,3.8) ; p=&a; p. get( ) ; }

45. #include < iostream. h > class point{ int x;

public: void init ( int a) { x = a; }

int getx( ){ return x;} void setx ( int a) { x = a; } };

void main( ){ point a; a. init (20,30) ;

cout << a. getx( ) << endl; }

四、完成程序题(本大题共5小题,每小题4分,共20分) 46.完成下面类中成员函数的定义。

class test { private: int nl ; float fl; public:

test(int,float f); test(test&); };

test::test( ________ ) {nl=n; fl=f;} test:: test(test&t) {nl=t.nl; fl=________;}

47.在下面程序中的下划线处填上适当的语句,使程序的输出结果如下:

11,77 11,77

http://www.zikao5.com 我自考网整理

源程序如下: #include using namespace std; class base { private: int x,y; public:

void initxy(int a,int b){x=a;y=b;} void show() {________} } ; void main() {

base a,b; __________ a.show(); b=a; b.show(); }

48.在下面程序中的下划线处填上适当的程序,使程序的输出结果如下:

x=1,y=2 x=30,y=40 源程序如下: #include class Sample { int x,y; public:

Sample(){x=y=0;}

Sample(int i,int j){x=i;y=j;} void copy(Sample & s);

void setxy(int i,int j){x=i;y=j;}

void print(){cout<<\,y=\;} };

void Sample::copy (________)

http://www.zikao5.com 我自考网整理

{

x=s.x;y=s.y; }

void func(________) ) {

s1.setxy(10,20); s2.setxy(30,40); }

void main() {

Sample p(1,2),q; q.copy(p); func(p,q); p.print(); q.print(); } Sample&s }

49.在下面程序的下划线处填上正确的语句,使其得到下面的输出结果。

20 21 22 a[0]=20 a[1]=21 a[2]=22 程序清单如下: #include < iostream > using namespace std; class base {

private:int x; public:

void setx(int a){x=a;}

http://www.zikao5.com 我自考网整理

int getx(){return x;} } ; void main() {

base a [3],*p; a[0].setx(20); a[1].setx(21); a[2].setx(22); for(p=a; p

50.在下面程序中的下划线处填上适当的程序,使程序的输出结果如下:

x=2,y=3 源程序如下: #include class Sample { int x,y; public:

Sample(){x=y=0;}

Sample(________){x=a;y=b;} void disp() {

cout<<\,y=\; } } ; void main() {

Sample s(2,3),________ P - >disp(); }

五、程序分析题(本大题共2小题,每小题5分,共10分) 51.请给出下面程序的输出结果

#include

  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

http://www.zikao5.com 我自考网整理 a. f1(1.6,3.8) ; p=&a; p. get( ) ; } 45. #include class point{ int x; public: void init ( int a) { x = a; } int getx( ){ return x;} void setx ( int a) { x = a; } }; void main( ){ point a; a. init (20,30) ; cout << a. getx( ) << endl; } 四、完成程序题(本大题共5小题,每小题4分,共20分) 46.完成下面类中成员函数的定义。 class test {

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com