皮皮学,免费搜题
登录
logo - 刷刷题
搜题
【简答题】
使用VC6打开考生文件夹下的工程test39_3。此工程包含一个test39_3.cpp,其中定义了类ARRAY和其派生类 STUDENT,其中类ARRAY是一个多态数组,该数组可以存放学校中的各类人员,如学生等,但它们的定义并不完整。请按要求完成下列操作,将程序补充完整。 (1)定义类ARRAY的三个公有成员纯虚函数add(int a)、del(int d)和show(int s),它们的返回值类型都是void型的。请在注释“//**1**”之后添加适当的语句。 (2)添加派生类STUDENT的保护数据成员float型的二维数组table,使其有row行和s_col列,请在注释“//**2**”。之后添加适当的语句。 (3)完成派生类STUDENT的成员函数del(int s)的定义,实现把二维数组第s行删除的功能,即把该行清零,请在注释“//**3**”之后添加适当的语句。 (4)完成派生类STUDENT的成员函数show(int s)的定义,使其以格式“'跳格table[行号][列号]is_换行”依次输出s行的各个元素,请在注释“//**4**”之后添加适当的语句。 源程序文件test39_3.cpp清单如下: include <iostream.h> include <stdlib.h> const int row = 100; const int s_col = 3; class ARRAY { public: // ** 1 ** } class STUDENT:public ARRAY { public: virtual void add(int s) { cout<<'/tInput data of STUDENT.'<<endl; cout<<'/tFirst:'; cin>>table[s] [0]; cout<<'/tSecond:'; cin>>table[s] [1]; cout<<'/tThird:'; cin>>table[s] [2]; } virtual void del(int s); virtual void show(int s); protected: int i; // ** 2 ** }; void STUDENT::del(int s) { // ** 3 ** } void STUDENT::show(int s) { cout<<endl; for(i=0;i<=s_col-1;i++) { // ** 4 ** } } int main() { STUDENT st; ARRAY* ap; ap=&st; ap->add(3); ap->show(3); ap->del(3); ap->show(3); return 0; }
手机使用
分享
复制链接
新浪微博
分享QQ
微信扫一扫
微信内点击右上角“…”即可分享
反馈
参考答案:
举一反三
【单选题】—Where is Wuhan? —It's _____ Hubei. [     ]
A.
or
B.
in
C.
to
D.
at
【单选题】社会信息化的一个重要标志是( )。
A.
国际社会联系越来越紧密
B.
世界变成了地球村
C.
互联网的飞速发展和广泛应用
D.
经济全球化出现
【单选题】—Where is Changsha? —It’s in ___________.
A.
Beijing             
B.
Hunan             
C.
Hubei
【判断题】Photoshop只能处理位图图像()
A.
正确
B.
错误
【单选题】—Could you please tell me _____? —I live in Enshi, Hubei. [     ]
A.
where do you live
B.
if you live in Enshi
C.
where you live
D.
where you were born
【单选题】Do you know _ buy Harry Potter in our city? [     ]
A.
where can I
B.
where I can
C.
I can where
D.
can I where
【单选题】I think it’s high time you _________ some measure to the problem.
A.
take
B.
takes
C.
took
D.
to take
【单选题】The small mountain village we spent our holiday last month lies in is now part of HUBEI.
A.
which;where
B.
where;what
C.
that;which
D.
when;which
【单选题】—Could you please tell me ? —Bus No. 536 will take you right there.
A.
where Hubei Museum is
B.
what Hubei Museum is like
C.
which bus I should take to Hubei Museum
【单选题】患者男,56岁,因急性胰腺炎入院治疗,术后第2天,腹腔引流管引流出胆汁样液体,应警惕
A.
胰瘘
B.
胆瘘
C.
出血
D.
肠瘘
相关题目:
参考解析:
知识点:
题目纠错 0
发布
创建自己的小题库 - 刷刷题