华南俳烁实业有限公司

自考

各地資訊
當(dāng)前位置:考試網(wǎng) >> 自學(xué)考試 >> 自考真題 >> 工學(xué)類(lèi) >> C語(yǔ)言程序設(shè)計(jì) >> 文章內(nèi)容

排行熱點(diǎn)

  • 歷年真題
  • 模擬試題
  • 自考自答

全國(guó)2013年10月自學(xué)考試C++程序設(shè)計(jì)試題_第4頁(yè)

來(lái)源:考試網(wǎng) [ 2013年11月23日 ] 【大 中 小】

三、改錯(cuò)題(本大題共5小題,每小題4分,共20分)

下面的每題中有一處錯(cuò)誤,請(qǐng)?jiān)凇按痤}紙”上將錯(cuò)誤所在行寫(xiě)出并給出修改意見(jiàn)。

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( ) ;

 }

責(zé)編:may1205
绥江县| 盖州市| 平果县| 财经| 神木县| 郁南县| 遂溪县| 临汾市| 新田县| 子长县| 连江县| 鹿泉市| 沾益县| 呼伦贝尔市| 社会| 徐汇区| 沂水县| 仁布县| 丽江市| 外汇| 蒲城县| 千阳县| 板桥市| 邯郸市| 广安市| 宾川县| 望都县| 大兴区| 营山县| 车致| 搜索| 壤塘县| 太康县| 交口县| 合山市| 葫芦岛市| 昭通市| 吉木萨尔县| 菏泽市| 公安县| 威海市|