华南俳烁实业有限公司

自考

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

排行熱點(diǎn)

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

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

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

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

51.給出下面程序的輸出結(jié)果

    #include  <iostream>

using namespace std;

 class base

 {

 int x;

 public:

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

 int getx ( ){return x;}

 } ;

 void main ( )

 {

 int*p;

 base a;

 a.setx (15);

 p= new int (a. getx( ));

 cout < < * p;

 }

52.給出下面程序的輸出結(jié)果

 #include < iostream >

 using namespace std;

 class base

 {

 private:

 int x;

 public:

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

 int getx ( ){return x;}

} ;

 void main ( )

 {

 base a,b;

 a.setx (89);

 b =a;

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

 cout < < b.getx ( ) < < endl;

}

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

53.在字符串類string中實(shí)現(xiàn)一個(gè)判斷函數(shù),該函數(shù)功能是統(tǒng)計(jì)某一字符串類對(duì)象(僅有單詞和空格組成)有多少個(gè)單詞,同時(shí)保存所有單詞在字符串中的起始地址(設(shè)該字符串不超過(guò)100個(gè)單詞)

#include < iostream. h >

#include < string >

class str{

 string s;  int n,a [ 100 ],j ,1;

 public:str ( string&a){s=a;n=0;j=0;l=0;}

 ....test (....);

   int * geta ( ){ return a;}

} ;

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

首頁(yè) 1 2 3 4 5 6 7 尾頁(yè)
責(zé)編:may1205
河曲县| 色达县| 苗栗县| 温州市| 宜春市| 连江县| 东台市| 封开县| 夹江县| 高密市| 卓资县| 延寿县| 安泽县| 略阳县| 大方县| 灵寿县| 马山县| 宜兰县| 新安县| 璧山县| 晋中市| 金川县| 和静县| 广德县| 宁国市| 四川省| 泸西县| 礼泉县| 临潭县| 神木县| 沅江市| 从化市| 鸡泽县| 重庆市| 兰考县| 弋阳县| 武邑县| 宁明县| 霸州市| 濮阳县| 和田市|