设为首页    加入收藏

自学考试省级导航

全国 A安徽 B北京 C重庆 F福建 G广东 广西 甘肃 贵州 H河南 河北 湖南 湖北 黑龙江 海南 J江苏 江西 吉林 L辽宁 N内蒙古 宁夏 Q青海 S山东 山西 陕西 四川 上海 T天津
     X新疆 西藏 Y云南 Z浙江 历年真题分类检索

全国2013年10月自学考试C++程序设计真题(打印word版)(四)
2015-02-09 18:51:58 来源:91考试网 作者:www.91exam.org 【

三、改错题(本大题共5小题,每小题4分,共20分)

下面的每题中有一处错误,请在“答题纸”上将错误所在行写出并给出修改意见。

41. #include <iostream.h>

     class point{

     private: float x,y;

     public: point( float a,float b){x=a;y=b;}

       void f(){x=0;y =0;}

 void getx(){cout<<x<<endl;}

       void gety(){cout<<y<<endl;}

     } ;

   main( ) {

     point a(3.5);

     a.getx( );

 }

42. #include < iostream. h >

 main( ) {

    int x =7;

    const int *p = &x;

    *p =99;

    cout << *p << endl;

    }

43. #include < iostream. h >

 class test{

     private: int x;y;

 public: voicl f( int a,int b) { x = a;y = b; }

       int max( ) { return(x > y) ? x:y; }

   };

 main( ) {

     test a;

     a. f( 1 ,3) ;

     cout << a. max( ) << endl;

     }

44. #include <iostream h >

 class test{

     private: int x;

 public:test(int a) { x = a; }

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

 void get( ) { cout << x << endl; }

 };

 class testl: public test{

 private: int x;

 public :testl ( int a) { x = a; }

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

 void get( ) { cout <<′′<< endl; }

 };

45. #include < iostream. h >

 class f{

 private: int x,y;

 public: fl ( int a,int b) { x = a;y = b; }

 void print( ) { cout << x << --<< y << endl; }

 };

 main( ) {

 f a;

 float x = 1.0,y = 2. 0;

 a. fl ( x,y) ;

 a. print( ) ;

 }

Tags:自学考试 历年真题
】【打印繁体】 【关闭】 【返回顶部
上一篇浙江2013年7月自学考试装饰材料与.. 下一篇浙江省2012年1月自学考试建筑工程..

网站客服QQ: 960335752 - 14613519 - 48225117