华南俳烁实业有限公司

自考

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

排行熱點(diǎn)

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

全國(guó)2012年10月自考C++程序設(shè)計(jì)試題_第11頁(yè)

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

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

51.下面程序中A是抽象類(lèi),其輸出是什么?

#include <iostream.h>

class A{

public:

virtual void printMe(){cout<<"This is class A printing. "<<endl;};

} ;

class B:public A{

public:

void printMe() {cout << "This is class B printing. "<<endl;}

} ;

class C:public B{

public:

void printMe() {cout <<"This is class C printing. "<<endl;}

} ;

void print(A a)

{

a.printMe();

}

void main()

{

B b;

C c;

print(b);print(c);

}

52.寫(xiě)出此程序的執(zhí)行結(jié)果:

#include <iostream.h>

template<class T>

T func(T x,T y){

if(sizeof(T)==8)

return x+y;

else

return x*y;

}

void main(){

cout <<func(8,5)<<":"<<func(5.0,10.0)<<endl;

int d;cin>>d:

}

責(zé)編:dengting
伊川县| 百色市| 东海县| 永顺县| 长乐市| 克山县| 武定县| 枣阳市| 苏尼特右旗| 仪征市| 潞西市| 龙井市| 琼中| 蓝山县| 高清| 闽清县| 武冈市| 正安县| 宁陕县| 南皮县| 兴山县| 盐边县| 安康市| 大方县| 聊城市| 双鸭山市| 沾化县| 衡阳市| 青阳县| 瑞安市| 德惠市| 子长县| 辉县市| 沙洋县| 新竹市| 清新县| 松溪县| 南部县| 宣威市| 垣曲县| 闽侯县|