亚洲欧洲国产欧美一区精品,激情五月亚洲色五月,最新精品国偷自产在线婷婷,欧美婷婷丁香五月天社区

      自考

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

      排行熱點(diǎn)

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

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

      來源:考試網(wǎng) [ 2011年12月10日 ] 【大 中 小】
      三、改錯(cuò)題(本大題共5小題,每小題4分,共20分)
      下面的每題中有一處錯(cuò)誤,請(qǐng)用下橫線標(biāo)出錯(cuò)誤所在行并給出修改意見
      41. #include < iostream. h >
      void main( ){
      float * p;
      p = new float[ 5 ] ;
      for( i =0;i <5 ;i + + )
      { cin > > * (p + i) ;cout << * (p + i) << endl; }
      delete [ ] p;
      }
      42. #include < iostream.h >
      template < class T >
      class f{
      private: T x,y;
      public: void fl(T a,T b){x=a;y=b;}
      T max(){retum(x>y)? x:y;}
      };
      void main( ){
      f <int> a;
      a. fl(3.5,3.8) ;
      cout << a. max( ) << endl;
      }
      43. #include < iostream. h >
      class test{
      private: static int x; int y;
      public: void testl ( int a, int b) { x = a; y = b; }
      };
      void main() {
      test a;
      a. testl (2,3) ;
      }
      44. #include < iostream, h >
      class f{
      private: float x, y;
      public: void fl ( float a, float b) { x = a; y = b; }
      f() {x=0;y=0;}
      void move(float a,float b){x =x +a;y =y-b;}
      void get ( ) { cout << x <<"<< y << endl; }
      };
      void main( ){
      f *p,a;
      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;
      }
      責(zé)編:snrvge