-
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
-
AACEncode
This program compress audio to AAC encoding format .
It is developed by visual studio 2010.
And written language C++.
- 2014-01-15 09:38:26下载
- 积分:1
-
boot_DC_DC
boost DC DC GOOD simulation
- 2014-02-14 00:25:31下载
- 积分:1
-
Sheffield-genetic-algorithm-toolbox
Matlab遗传算法工具箱(Sheffield大学版) 最优秀的遗传算法工具箱(Matlab genetic algorithm toolbox (university of Sheffield)- the best genetic algorithm toolbox)
- 2014-11-06 10:06:49下载
- 积分:1
-
hamming
汉明码编码译码源码,谢谢大家分享,~~~~(Hamming code encoding decoding source code, thank you for sharing)
- 2010-03-12 15:00:04下载
- 积分:1
-
ab
说明: 可以读出股票作为个人在股票软件方面的一个小尝试(Can be read as an individual stock in the stock software is a small attempt)
- 2010-04-16 01:51:06下载
- 积分:1
-
2-D-FDTD-TE-code-with-PML
一个二维的fdtdc++编写的程序,较完整,带有pml边界条件。感兴趣的可以下载看看。(A two-dimensional fdtdc++ preparation procedures, more complete, with pml boundary conditions. Interested can download to see.)
- 2014-02-24 22:14:52下载
- 积分:1
-
RMSC
Robust Multi-View Spectral Clustering via Low-Rank and Sparse Decomposition
- 2021-04-15 19:38:54下载
- 积分:1
-
Decoupled-load-flow
采用稀疏矩阵的PQ分解法潮流计算程序(依据《电力系统计算》一书附录用C语言编写,使用方法、变量名称都与书上一致)(Decoupled load flow)
- 2013-12-07 13:33:07下载
- 积分:1
-
music
music matlab程序,c语言实现的一个小星星的音乐(music matlab procedures, c language a little star music)
- 2013-09-28 09:38:41下载
- 积分:1