-
6_1
1. 定义一个抽象学生类CStudent,它具有公有成员函数Average(),该函数用于计算学生的平均分,函数为虚函数;定义一个文科学生类CStudentLiberalArts,它是类CStudent的派生类,并以公有方式派生,它具有的成员有:
1) 保存英语、政治、数学、地理和历史、美术成绩的整形成员变量;
2) 设置上述变量的公有成员函数;
3) 输出上述变量的公有成员函数;
4) 公有的成员函数Average()用于计算学生的平均分;
定义一个理科学生类CStudentScience,它是类CStudent的派生类,并以公有方式派生,它具有的成员为:
1) 保存英语、物理、数学、化学和计算机、程序设计成绩的整形成员变量;
2) 设置上述变量的公有成员函数;
3) 输出上述变量的公有成员函数;
4) 公有的成员函数Average()用于计算学生的平均分;
编写主函数,并测试以下内容:
1) 定义一个CStudent的指针数组pStu,数组长度为4;
2) 动态创建2个文科学生的对象,地址存于pStu数组的0-1个元素内;
3) 动态创建2个理科学生的对象,地址存于pStu数组的2-3个元素内;
4) 利用while循环调用数组里每个元素的计算平均成绩操作;
释放动态分配的空间,确保必要的析构函数能被调用。
(1 define an abstract class student CStudent, it has a public member function Average (), this function is used to calculate the student s average points function as virtual function definition of a liberal arts student class CStudentLiberalArts, it is the class CStudent derived class, and public be derived, which has members are:
1) Save English, shaping member variables politics, mathematics, geography and history, art achievements
2) Set the above variables public member function
3) public member function of the output of the variable
4) public member function Average () is used to calculate the average student s points
The definition of a science student class CStudentScience, it is the class CStudent derived class, and public manner derived, which has members as follows:
1) Save English, physics, mathematics, chemistry and computer programming achievement shaping member variables
2) Set the above variables public member function
3) public member function of t)
- 2014-10-20 15:29:16下载
- 积分:1
-
MATLAB-SimMechanics
MATLAB-SimMechanics机构动态仿真讲解教程(Dynamic simulation of MATLAB-SimMechanics bodies to explain the tutorial)
- 2012-06-27 16:39:36下载
- 积分:1
-
NNavBarra
一个navigation vieew的xcode手机程序可直接使用。
(A navigation vieew the xcode phone program can be used directly.)
- 2012-07-29 20:39:40下载
- 积分:1
-
BAnet-and-MATLAB
无标度网络简介 生成原则 matlab程序代码以及最终成图plot(Introduction to generate scale-free network matlab code principles and ultimately into the chart plot)
- 2013-11-24 15:56:39下载
- 积分:1
-
xiliepingshun
求解系列重型商用车的平顺性,求解结果收敛性良好。(Solving a series of heavy commercial vehicles, ride comfort, and solving the resulting convergence is good.)
- 2012-08-15 11:42:01下载
- 积分:1
-
jindaipingcha
近代平差,含有近代经典平差函数模型,适用于数据处理中的近代平差应用(Modern adjustment, containing a model of modern classical adjustment function for data processing applications in modern Adjustment)
- 2014-02-17 10:19:29下载
- 积分:1
-
1-(8)
Unit Commitment in a Competitive and Emission
Constrained Environment
- 2015-04-03 21:34:01下载
- 积分:1
-
ostu
最大类间方差法求阈值(thanks)
- 2010-05-22 17:58:40下载
- 积分:1
-
SplashScreen_VC
AppWizard has created this SplashScreen application for you.It is programmed by visual C++.(AppWizard this has created a SplashScreen pplication for you.It is programmed by visual C .)
- 2006-10-30 12:24:46下载
- 积分:1
-
MatlabPID
笔者费了很大的经历找到的matlab实例资料,希望大家好好利用,绝对经典的好资料哦(Programming with vc for the sample program, which contains many of the author s experience, I hope you make good use of)
- 2011-12-22 10:18:56下载
- 积分:1