- 博客(6)
- 资源 (1)
- 收藏
- 关注
原创 C++ Graduate类
定义Person类,由Person分别派生出Teacher类和Cadre(干部)类,再由Teacher类和Cadre类,采用多重继承方式派生出新类TeacherCadre,要求:(1)在Person类中包含的数据成员有姓名(name)、年龄(age)、性别(sex)。在Teacher类中还包含数据成员职称(title), 在Cadre类中还包含数据成员职务(post),工资(wages),在TeacherCadre类中不新增数据成员;(2)在类体中定义成员函数(根据实际情况包含构造、析构函数)(3)每
2020-05-28 18:14:40
496
原创 C++Person类继承
定义Person类,由Person分别派生出Teacher类和Cadre(干部)类。要求如下:(1)数据成员:1、在Person类中包含的数据成员有姓名(name)、年龄(age)、性别(sex)。2、在Teacher类中包含数据成员职称(title)。3、在Cadre类中包含数据成员职务(post)、工资(wages)。(2)成员函数:1、在类体中定义成员函数(根据实际情况包含构造、析构函数)2、每个类都有显示信息函数(Show)(3)主函数测试:主函数中分别定义Person类、 Tea
2020-05-28 18:13:34
5063
原创 C++对象数组 —— 学生信息表
编写一个能管理多条学生信息的程序。#include <string>#include <iostream>using namespace std;class Student{ //在此处声明所需的成员 public: int SID; string Name; float Score; Student(); Student(int sid,string name,float sco);};Student::Student(){}Student::
2020-05-28 18:12:14
6158
原创 C++构造函数 —— 学生信息类
设计一个带有构造函数和析构函数的学生类。#include<iostream>#include<string>using namespace std;class Student{private:int SID;string Name;public:Student();Student(int sid,string name);~Student();//在此处声明所需的成员};Student::Student(int sid,string name){
2020-05-28 18:10:33
7447
1
原创 C++设计一个长方形类
设计一个长方形类设计一个长方形类,通过访问它的成员变量来计算面积。class Rectangle{ //在此处实现Rectangle类 private: int height; int width;public: void Set(int h,int w); int GetArea(); };void Rectangle::Set(int h,int w){ height=h; width=w;}int Rectangle::G
2020-05-28 18:08:53
12850
2
原创 C++声明并定义一个学生信息类。
声明并定义一个学生信息类#include <iostream>#include<cstring>using namespace std;class StInfo{ public: int SID; char Name[20]; char Class[20]; char Phone[20]; void SetInfo(int a,char b[],char c[],char d[]); void PrintInfo();};void StInfo:
2020-05-28 18:06:21
12608
1
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人