华南俳烁实业有限公司

自考

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

排行熱點(diǎn)

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

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

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

  30.C++類(lèi)中的______函數(shù)在對(duì)象的生存期結(jié)束時(shí)被自動(dòng)調(diào)用。

  31.C++語(yǔ)言中的整數(shù)常量有四種:十進(jìn)制常量、長(zhǎng)整型常量、八進(jìn)制常量和______。

  32.UML中對(duì)象之間的靜態(tài)關(guān)系是通過(guò)對(duì)象屬性之間的連接反映的,稱(chēng)之為_(kāi)_____。

  33.聲明一個(gè)常成員函數(shù)Fun,返回類(lèi)型為char,第一個(gè)參數(shù)類(lèi)型為int,第二個(gè)參數(shù)類(lèi)型為double,則該函數(shù)的聲明原型是______。

  34.在C++語(yǔ)言中,利用向量類(lèi)模板定義一個(gè)具有20個(gè)int類(lèi)型且初值為1的向量C,實(shí)現(xiàn)此操作的語(yǔ)句是______。

  35.執(zhí)行下列代碼:int a=123,b=321;cout<

  36.將指向?qū)ο蟮闹羔樧鳛楹瘮?shù)參數(shù),形參是對(duì)象指針,實(shí)參是對(duì)象的______。

  37.vector類(lèi)中用于返回向量中第一個(gè)對(duì)象的方法是______。

  38.C++語(yǔ)言中動(dòng)態(tài)分配內(nèi)存的關(guān)鍵字是______。

  39.C++類(lèi)成員的訪(fǎng)問(wèn)權(quán)限有______、公有和保護(hù)三種。

  40.寫(xiě)出聲明一個(gè)復(fù)數(shù)對(duì)象num的語(yǔ)句,并使對(duì)象被初始化為單精度2.2+1.3i,此聲明語(yǔ)句是______。

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

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

  41.#include

  main ( ){

  int x=5,y=6;

  const int *p=&x;

  * p=y;

  cout<<*p<

  }

  42.#include

  class f {

  private:T x, y;

  public:f1(T a,T b){x=a;y=b;}

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

  };

  main( ) {

  f a;

  a.f1(1.5,3.8);

  cout<

  }

  43.#include

  class point {

  private:float x,y;

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

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

  void getx( ){cout<

  void gety( ){cout<

  };

  main( ) {

  point a (3.5);

  a.getx( );

  }

  44.#include

  class f{

  private:float x,y;

  float get( ){return x+y;}

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

  };

  main( ) {

  f a;

  a.f1(1,3.8);

  cout<

  }

  45.#include

  class testl{

  private:Int x;

  public:testl( ){x=2;}

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

  void get(){cout<

  };

  class test2{

  private:int x;

  public:test2( ){x=3;}

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

  void get( ){cout<

  };

  class test:public testl,public test2.{

  private:int x;

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

  void gettest( ){cout<

  };

  main( ) {

  test a;a.get( );

  }

  四、完成程序題(本大題共5小題,每小題4分,共20分)

  46.完成下面類(lèi)中的成員函數(shù)的定義。

  class point

  {

  private:

  int m,n;

  public:

  point(int,int);

  point(point&);

  };

  point::point(int a,int b)

  {

  m=a;

  _____=b;

  }

  point::point(______)

  {

  m=t.m;

  n=t.n;

  }

  47.#include

  using namespace std;

  class base

  {

  private:int x;

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

  int get( ){return x;}

  void showbase( ) {cout<<"x="<

  };

  class Derived:public base

  {private:int y;

  public:Derived(int a,int b):base(a) {y=b;}

  void showderived( )

  {cout<<"x="<

  if(! fout.is_open( ))

  return;

  for(int i=0;i<3;i=i+1)

  fout<<"This is line"<

  fout.close( );

  fin.open("my.txt",ios::in);

  if(! fin.is_open( ))

  return;

  char str[100];

  while(______)

  {

  fin.getline(str,100);

  cout<

  }

  fin.close( );

  }

  50.求兩個(gè)浮點(diǎn)數(shù)之差的cha函數(shù)的原型聲明、調(diào)用方法。

  #include

  using namespace std;

  void main( )

  {

  float a,b;

  ______;∥函數(shù)cha的原型聲明

  a=12.5;

  b=6.5;

  float c=__________;∥調(diào)用函數(shù)cha

  cout<

  }

  float cha(float x,float y)

  {

  float w;

  w=x-y;

  return w;

  }

  五、程序分析題(本大題共2小題,每小題5分,共1O分)

  51.#lnclude

  void func( );

  void main( )

  {

  for(inti=0;i<6;i++)

  {

  func( );

  }

  }

  void func( )

  {

  int x=0;

  x ++;

  static int y=0;

  y ++;

  cout<<"x="<

  }

  void main( )

  {

  A a,b;

  a.Show( );

  b.Show( );

  }

  六、程序設(shè)計(jì)題(本大題共1小題,共10分)

  53.在三角形類(lèi)tri實(shí)現(xiàn)兩個(gè)函數(shù),功能是輸入三個(gè)頂點(diǎn)坐標(biāo)判斷是否構(gòu)成等邊三角形

  #include

  #include

  class point { point

  private:float x,y;

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

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

  Void set(float a,float b){x=a;y=b;}

  float getx( ){return x;}

  noat gety( ){return y;}

  };

  class tri{

  point x,y,z;

  float s1,s2,s3;

  public....settri(....);∥用于輸入三個(gè)頂點(diǎn)坐標(biāo)

  ....test(....);∥用于判斷是否構(gòu)成等邊三角形

  };

  請(qǐng)寫(xiě)出兩個(gè)函數(shù)的過(guò)程(如果需要形式參數(shù),請(qǐng)給出形參類(lèi)型和數(shù)量,以及返回值類(lèi)型)

首頁(yè) 1 2 尾頁(yè)
責(zé)編:duan123
搜索| 县级市| 保山市| 辉县市| 瑞金市| 明溪县| 宁安市| 治多县| 唐河县| 盘锦市| 江油市| 禹城市| 岳普湖县| 南召县| 渝北区| 明星| 许昌县| 富宁县| 马公市| 乡宁县| 玉环县| 汕头市| 察隅县| 九龙城区| 斗六市| 周至县| 会泽县| 曲水县| 沅陵县| 榆林市| 铜鼓县| 阿拉善左旗| 濮阳县| 富锦市| 疏附县| 宜阳县| 伽师县| 鄂托克前旗| 上林县| 古蔺县| 当雄县|