华南俳烁实业有限公司

自考

各地資訊
當前位置:考試網(wǎng) >> 自學考試 >> 自考真題 >> 工學類 >> C語言程序設計 >> 文章內容

排行熱點

全國2011年10月高等教育自學考試C++程序設計試題_第5頁

來源:考試網(wǎng) [ 2011年12月10日 ] 【大 中 小】
四、完成程序題(本大題共5小題,每小題4分,共20分)
46.完成下面類中成員函數(shù)的定義。
class test
{
private:
int nl ;
float fl;
public:
test(int,float f);
test(test&);
};
test::test( ________ )
{nl=n; fl=f;}
test:: test(test&t)
{nl=t.nl;
fl=________;}

47.在下面程序中的下劃線處填上適當?shù)恼Z句,使程序的輸出結果如下:
11,77
11,77
源程序如下:
#include<iostream>
using namespace std;
class base
{
private:
int x,y;
public:
void initxy(int a,int b){x=a;y=b;}
void show()
{________}
} ;
void main()
{
base a,b;
__________
a.show();
b=a;
b.show();
}
48.在下面程序中的下劃線處填上適當?shù)某绦,使程序的輸出結果如下:
x=1,y=2
x=30,y=40
源程序如下:
#include<iostream.h>
class Sample
{
int x,y;
public:
Sample(){x=y=0;}
Sample(int i,int j){x=i;y=j;}
void copy(Sample & s);
void setxy(int i,int j){x=i;y=j;}
void print(){cout<<"x="<<x<<",y="<<y<<endl;}
};
void Sample::copy (________)
{
x=s.x;y=s.y;
}
void func(________)
)
{
s1.setxy(10,20);
s2.setxy(30,40);
}
void main()
{
Sample p(1,2),q;
q.copy(p);
func(p,q);
p.print();
q.print();
}
Sample&s
}

責編:snrvge
四子王旗| 怀柔区| 河西区| 溧阳市| 犍为县| 林芝县| 潜江市| 乌拉特前旗| 霍林郭勒市| 宁武县| 雷山县| 永新县| 毕节市| 奉化市| 楚雄市| 邢台市| 长沙市| 岳普湖县| 静安区| 汉源县| 曲靖市| 德令哈市| 六安市| 肥东县| 体育| 通榆县| 繁峙县| 酒泉市| 古丈县| 丽水市| 时尚| 电白县| 锡林郭勒盟| 徐水县| 峨眉山市| 鄂州市| 九江市| 钦州市| 泾源县| 娱乐| 法库县|