- 博客(15)
- 收藏
- 关注
原创 第十三周 项目1 确定点在圆上的位置(补发)
#include #includeusing namespace std;class Point{public: Point(double a=0,double b=0):x(a),y(b) {} //构造函数 double distance(const Point &p) const; //求距离 friend ostream & operato
2014-05-27 14:54:21 720
原创 第十四周 oj 利用虚函数-计算图形面积
#include #include using namespace std;class Shape{public: virtual double area() const = 0;};class Circle:public Shape{private : double r;public : Circle(double rr):
2014-05-27 14:33:17 897
原创 第十四周 【项目3-立体类族共有的抽象类】
#includeusing namespace std;class CSolid{public: virtual double area() const =0; virtual double vv() const =0;};class CCube:public CSolid{private: double r;public:
2014-05-27 09:12:03 656
原创 第十四周 【项目2-形状类族的中的纯虚函数】
#includeusing namespace std;class Shape{public: virtual double area() const =0;};class Circle:public Shape{private: double r;public: Circle(double rr):r(rr){}; vi
2014-05-27 08:56:20 559
原创 第十四周 【项目1-动物这样叫】下面是给出的基类Animal声明和main()函数。
#include #include using namespace std;class Animal{public: virtual void cry() { cout<<"不知哪种动物,让我如何学叫?"<<endl; }};class Mouse:public Animal{private: string n
2014-05-27 08:33:03 1362
原创 第十一周 项目 3 点类派生直线类
#include#includeusing namespace std;class Point //定义坐标点类{public: Point():x(0),y(0) {}; Point(double x0, double y0):x(x0), y(y0) {}; double getX() { return x;
2014-05-13 15:02:20 893
原创 第十二周 项目1 . 3
#include using namespace std;class Animal{public: Animal() {} void eat() { cout << "eat\n"; }protected: void play() { cout << "play\n"; }
2014-05-13 14:24:21 779
原创 第十二周 项目1 . 2
#include using namespace std;class Animal{public: Animal() {} void eat() { cout << "eat\n"; }protected: void play() { cout << "play\n";
2014-05-13 14:21:44 704
原创 第十二周 项目1 项目1 - 长颈鹿类对动物类的继承
#include using namespace std;class Animal //动物类{public: Animal() {} void eat(){ cout << "eat\n"; }//protected: void play() { cout << "play\n";
2014-05-13 14:07:12 645
原创 第十二周 项目4 日期时间类
#include using namespace std;class Date{public: void SetDate(int y,int m,int d) { Year=y; Month=m; Day=d; } void PrintDate () { cou
2014-05-13 09:33:54 874
原创 第十二周 项目2 教师兼干部类
#include#include using namespace std;class Teacher{public: Teacher(string nam,int a,char s,string tit,string ad,string t); void display();protected: string name; int age; char se
2014-05-13 08:58:22 719
原创 第十二周 项目3 摩托车继承自行车和机动车
#include #include#include using namespace std;enum vehicleStaus {rest, running}; //车辆状态:泊车、行进class vehicle //车辆类{protected: int maxSpeed; //最大车速 int currentSpeed; //当前速度
2014-05-13 08:48:20 1050
原创 第十一周 项目 3 点类派生直线类
#include #includeusing namespace std;class Point{public: Point():x(0),y(0){}; Point(double x0,double y0):x(x0),y(y0){}; void PrintPoint(); double x,y;};void Point::Prin
2014-05-06 15:20:20 616
原创 第十一周 项目 2 职员也有工资了
#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,int
2014-05-06 15:03:16 640
原创 第十一周 项目 1 班长和学生的信息
#include using namespace std;class Stu //声明基类{public: Stu(int n, string nam ) { num=n; name=nam; } //基类构造函数 void display( ) { cout<<"学号是"
2014-05-06 14:42:16 678
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人