-
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
-
figtojpg
matlab写的将fig格式图片转成jpg格式的源代码(matlab write the fig format jpg format image into the source code)
- 2013-12-03 21:10:47下载
- 积分:1
-
yichuansuanfa
说明: 很好的遗传算法,改改可以应用在很多方面.希望对大家有用(Good genetic algorithm, can be applied changed in many ways. Hope everyone useful)
- 2008-10-06 18:23:24下载
- 积分:1
-
2010rili
说明: 一个用excel生成的日历可以从1900年2099年!可以根据开始的年费进行调整!!!并标注重要日期(A calendar can be generated using excel 1900 and 2099 from! Can begin to adjust the annual fee! ! ! And mark important dates)
- 2011-03-17 17:43:52下载
- 积分:1
-
eof
eof分解 想要的拿走吧 自己随便写的 有问题的话可以email我(eof decomposition want take it easily write their own needs to take the trip)
- 2013-09-25 22:54:43下载
- 积分:1
-
fingfang_v27
包括单边带、双边带、载波抑制及四倍频,有借鉴意义哦,AHP层次分析法计算判断矩阵的最大特征值。( Including single sideband, double sideband, suppressed carrier and quadruple, There are reference Oh, Calculate the maximum eigenvalue judgment matrix of AHP.)
- 2016-05-26 10:11:30下载
- 积分:1
-
precision
dct transform 2d 변 환 과 정 을 나 타 내 는 소 스 코 드
- 2010-06-06 21:30:02下载
- 积分:1
-
ebp4
用“提前停止”方法提高BP网络推广能力
本例将用提前停止和训练函数TRAINGDX相结合来避免“过度拟合”产生的误差
(The " early stopping" method to enhance the promotion of BP network capacity will be used in this case in advance and training function to stop the combination of TRAINGDX to avoid " over-fitting" error)
- 2009-05-09 23:48:08下载
- 积分:1
-
gatsp1
matlab程序,遗传算法解决经典的TSP(旅行商)问题(Matlab procedures, genetic algorithm to solve the classic TSP salesman problem (TSP))
- 2007-03-13 09:28:36下载
- 积分:1
-
aa11
闭环系统的奇异值曲线仿真和其鲁棒性能分析(Singular value of the closed-loop system curve simulation and robust performance analysis)
- 2012-09-26 17:22:08下载
- 积分:1