原创 動物這樣叫(多態性、虛函數和抽象類)

#include <iostream> #include <string> using namespace std; class Animal { public: Animal(string na):name(na){}

原创 c++習題1_B_c++繼承改錯

/* *作者:lws *完成時間:2014/6/12 *輸入:1 2 3 4 5 *輸出:a:3 b:4 a:3 b:4 c:5 */ #include <iostream> using namespace std; class A {

原创 長頸鹿類對動物類的private繼承

#include <iostream> using namespace std; class Animal { public: Animal() {} void eat() { cout << "e

原创 項目1-工資數據的輸入_續

/* *作者:lws *完成日期:2014/6/3 *問題描述:輸入若干職工的工資(1000-10000的數字),將這些數字按降序排序後輸出 *實現:寫入數據後,按降序排序,輸出到文件裏 */ #include <iostream> #i

原创 項目1-工資數據的輸入

/* *作者:lws *完成日期:2014/6/3 *問題描述:輸入若干職工的工資(1000-10000的數字),將這些數字按降序排序後輸出 */ #include <iostream> #include <cstdio> //支持f

原创 形狀類族的中的純虛函數

#include <iostream> #include <cmath> using namespace std; class Shape { public: virtual double area()=0; }; class C

原创 類族的設計

#include <iostream> using namespace std; class Point //點類 { public: Point():x(0),y(0){} Point(double x0,double y0):x(

原创 長頸鹿類對動物類的public繼承

#include <iostream> using namespace std; class Animal //動物類 { public: Animal() {} void eat(){ cout <

原创 存儲班長信息的學生類

#include <iostream> #include <string> using namespace std; class Stu //聲明基類 { public: Stu(int n,string nam); void di

原创 教師兼幹部類

#include <iostream> #include <string> using namespace std; class Teacher//教師類 { public: Teacher(string na,int ag,char

原创 職員有薪水了

#include <iostream> #include <string> using namespace std; class CPerson { protected: char *m_name; char *m_id;

原创 c++習題1_A_長方體繼承自矩形

/* *作者:lws *完成時間:2014/6/12 *輸入:長方體的長,寬,高 *輸出:長方體的體積 */ #include <iostream> using namespace std; class Rectangle //矩形類 {

原创 c++習題1_C_複數運算符重載(+與

/* *作者:lws *完成時間:2014/6/12 *輸入:3 4 5 -10 3 4 5 5 3 4 *輸出:c1+c2=(8.00-6.00i) c1+d=(8.00+4.00i) d+c1=(8.00+4.00i) */ #inc

原创 項目2 - 用文件保存的學生名單

/* *作者:lws *完成時間:2014/6/5 *問題描述:文件操作 */ #include <iostream> #include <string> #include <fstream> #include <cstdlib> #in

原创 長頸鹿類對動物類的protected繼承

#include <iostream> using namespace std; class Animal { public: Animal() {} void eat() { cout << "e