自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(19)
  • 收藏
  • 关注

原创 14.3

/*设计一个抽象类CSolid,含有两个求表面积及体积的纯虚函数。设计个派生类CCube、CBall、CCylinder,分别表示正方体、球体及圆柱体。在main()函数中,定义基类的指针p(CSolid *p;),利用p指针,输出正方体、球体及圆柱体对象的表面积及体积。*/#include using namespace std;class CSolid{

2014-05-29 20:11:56 812

原创 14.2

#include using namespace std;class Shape{ public: virtual double area()=0;};class Circle:public Shape{ public: Circle(double r):R(r){} virtual double area();

2014-05-29 19:32:51 1200

原创 14.1

#include #include using namespace std;class Animal{public: Animal(string nam):name(nam){} virtual void cry()=0; protected: string name;};class Mouse:public Animal{

2014-05-29 19:08:31 699

原创 14.1

#include #include using namespace std;class Animal{public: virtual void cry()=0;};class Mouse:public Animal{ public: Mouse(string nam,char s):name(nam),sex(s){} vir

2014-05-29 18:58:05 666

原创 14.1

#include using namespace std;class Animal{public: Animal(string nam):name(nam){} virtual void cry() { cout<<"不知哪种动物,让我如何学叫?"<<endl; }protected: string name;};c

2014-05-29 18:52:07 801

原创 13.3

#include #includeusing namespace std;class Circle; //由于在Point中声明友元函数crossover_point中参数中用了Circle,需要提前声明class Point{ public: Circle(double xx,double yy):x(xx),y(yy){} friend os

2014-05-28 17:22:42 681

原创 13.2

/*(1)先建立一个Point(点)类,包含数据成员x,y(坐标点);(2)以Point为基类,派生出一个Circle(圆)类,增加数据成员(半径),基类的成员表示圆心;(3)编写上述两类中的构造、析构函数及必要运算符重载函数(本项目主要是输入输出);(4)定义友元函数int locate,判断点p与圆的位置关系(返回值0 圆外); 在项目1的基础上,在圆类上重载关系运算符(

2014-05-27 14:56:04 773

原创 acm.2

#include #include using namespace std;class Complex{public:Complex():real(0),imag(0) {}Complex(double r,double i):real(r),imag(i) {}Complex operator+(Complex &);Complex operator+(d

2014-05-27 09:14:07 482

原创 13.1

#include using namespace std;class Point{ public: Point(double xx,double yy):x(xx),y(yy){} void display() { cout<<"("<<x<<","<<y<<")"; } protected: d

2014-05-27 09:12:41 731

原创 12.3

#include #include#include using namespace std;enum vehicleStaus {rest, running}; //车辆状态:泊车、行进class vehicle //车辆类{protected: int maxSpeed; //最大车速 int currentSpeed; //当前速度

2014-05-19 18:22:37 449

原创 12.2

#include using namespace std;class Teacher{public:Teacher(string nam,int a,char s,string ad,string c,string t);void display();protected: string name; int age; char sex;

2014-05-19 10:26:20 643

原创 12.1.3

#include using namespace std;class Animal{public: Animal() {} void eat() { cout << "eat\n"; }protected: void play() { cout << "play\n"; }

2014-05-13 15:27:51 717

原创 12.1.2

#include using namespace std;class Animal{public: Animal() {} void eat() { cout << "eat\n"; }protected: void play() { cout << "play\n"; }

2014-05-13 15:22:52 902

原创 12.1.1

#include using namespace std;class Animal //动物类{public: Animal() {} void eat(){ cout << "eat\n"; }protected: void play() { cout << "play\n";

2014-05-13 15:18:28 414

原创 点派生类直线

#include#includeusing namespace std;class Point //定义坐标点类{public: Point():x(0),y(0) {}; Point(double x0, double y0):x(x0), y(y0) {}; void PrintPoint(); //输出点的信息 double get

2014-05-13 15:01:28 463

原创 职员有薪水了

#include using namespace std;class CPerson{protected: string m_szName; string m_szId; int m_nSex;//0:women,1:man int m_nAge;public: CPerson(string name,string id,i

2014-05-13 09:40:37 483

原创 11.1

#include using namespace std;class Stu //声明基类{public: Stu(int n, string nam ); //基类构造函数 void display( ); //成员函数,输出基类数据成员protected: //(*)访问权限为保护型的数据成员 int num;

2014-05-11 22:10:30 454

原创 9.2

#include using namespace std;class CTime{private: unsigned short int hour; // 时 unsigned short int minute; // 分 unsigned short int second; // 秒public: CTime(int h=0,int m=0,

2014-05-11 21:10:48 526

原创 9.1

#include using namespace std;class Complex{public: Complex() { real=0; imag=0; } Complex(double r,double i) { real=r; imag=i;

2014-05-11 21:10:10 410

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除