- 博客(91)
- 收藏
- 关注
原创 银行系统
main.cpp #include #include #include #include #include #include #include "bank.h" using namespace std; //业务员登陆 int denglu() { ifstream infile("passer.txt",ios::out); if(!infile) { cout<<"文件
2015-07-17 17:09:35
686
原创 第14周项目1(1)-小玩文件
#include #include #include using namespace std; int main() { fstream file; file.open("abc.txt",ios::in); // (2) if(!file) { cout<<"abc.txt can’t open."<<endl; exit(1);
2015-06-10 17:48:43
391
原创 第13周项目3-立体类族共有的抽象类
#include #include using namespace std; class CSolid { public: virtual double area()=0; virtual double volume()=0; }; class CCube:public CSolid { private: double a; public:
2015-06-03 09:20:15
846
原创 第13周项目2-形状类族的中的纯虚函数
#include #include using namespace std; class Shape { public: virtual double area()=0; }; class Circle:public Shape { private: double r; public: Circle(double a):r(a){};
2015-06-03 08:46:25
387
原创 第13周项目1-动物这样叫
#include #include using namespace std; class Animal { public: virtual void cry() { cout<<"不知哪种动物,让我如何学叫?"<<endl; } }; class Dog:public Animal { protected: string name; public:
2015-06-02 22:25:38
436
原创 第12周项目4-圆与点的关系
#include #include using namespace std; class Point { public: Point() :x(0), y(0){}; Point(int xx, int yy) :x(xx), y(yy){}; friend ostream &operator<<(ostream &out, const Point &a); int x; int
2015-05-30 22:01:09
667
原创 第12周项目3-日期时间类
#include using namespace std; class Date { protected: int year; int month; int day; public: Date() :year(0), month(0), day(0){}; Date(int a, int b, int c) :year(a), month(b), day(c) {}; void Se
2015-05-30 11:43:24
387
原创 第12周项目1-教师兼干部类
#include #include using namespace std; class Teacher { protected: string name; int sex; int age; string address; int phone; string title; public: Teacher():n
2015-05-27 09:06:32
410
原创 第11周项目3—点类派生直线类
#include #include using namespace std; class Point //定义坐标点类 { public: Point():x(0),y(0) {}; Point(double x0, double y0):x(x0), y(y0) {}; double getx(); double gety(); void PrintPoi
2015-05-26 10:48:40
553
原创 第11周项目2(2)职员有薪水了
#include using namespace std; class CPerson { protected: char *m_szName; char *m_szId; int m_nSex;//0:women,1:man int m_nAge; public: CPerson(char *name,char *id,int sex,int age
2015-05-23 17:35:47
600
原创 第11周项目2-职员有薪水了
#include #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,st
2015-05-20 17:00:50
443
原创 第11周项目1-存储班长信息的学生类
#include #include using namespace std; class Stu //声明基类 { public: Stu(int n, string nam ); //基类构造函数 void display( ); //成员函数,输出基类数据成员 protected: //(*)访问权限为保护型的数据成员
2015-05-20 09:12:53
402
原创 第11周项目0-是春哥啊
#include #include using namespace std; class Person{ public: Person(char* s){ strcpy(name,s); } void display( ){ cout<<"Name: "<<name<<endl; } private:
2015-05-20 08:19:05
680
原创 第9周项目5-方程类
#include #include using namespace std; class CEquation { private: double a; // 未知数系数 double b; // 常数项 char unknown; // 代表未知数的符号 public: CEquation(double aa=0,double bb=0);
2015-05-19 13:09:03
821
原创 第9周项目4-我的向量类
#include #include using namespace std; class MyVector //定义向量类 { public: MyVector(int m); //构造函数,共有m个元素的向量,元素值预置为0 MyVector(const MyVector &v); //复制构造函数 ~MyVector(); //析构函数:释放
2015-05-19 12:25:23
376
原创 第9周项目1-复数类中的运算符重载(续)
#include using namespace std; class Complex { public: Complex(){real=0;imag=0;} Complex(double r,double i){real=r; imag=i;} friend Complex operator+(const Complex &c1,const Complex &c2);
2015-05-19 10:32:42
522
原创 第8周项目4-string类
#include using namespace std; class String { public: String operator +(string &a); String operator -(string &a); void display(); //需要的成员函数(若需要的话,声明友元函数) private: char
2015-05-18 17:17:32
341
原创 第8周项目3-分数类中的运算符重载
#include using namespace std; class CFraction { private: int nume; // 分子 int deno; // 分母 public: CFraction(int n=0,int d=1):nume(n),deno(d){}; CFraction operator +(CFraction &a);
2015-05-18 16:56:16
520
原创 第8周项目2-运算符重载
#include using namespace std; class CTime { private: int hour; // 时 int minute; // 分 int second; // 秒 public: CTime(int h=0,int m=0,int s=0); void setTime(int
2015-05-13 09:12:30
456
原创 第8周项目1(3)—扩充运算符功能
#include using namespace std; class Complex { public: Complex(){real=0;imag=0;} Complex(double r,double i){real=r; imag=i;} friend Complex operator+(const Complex &c1,const Compl
2015-04-29 09:14:05
477
原创 第8周项目1(2)—用友元函数实现复数类运算符重载
#include using namespace std; class Complex { public: Complex(){real=0;imag=0;} Complex(double r,double i){real=r; imag=i;} friend Complex operator+(const Complex &c1,const Compl
2015-04-29 09:13:43
453
原创 第8周项目1(1)-用成员函数实现复数类中的运算符重载
#include using namespace std; class Complex { public: Complex(){real=0;imag=0;} Complex(double r,double i){real=r; imag=i;} Complex operator+(const Complex &c2); Complex ope
2015-04-29 09:11:50
674
原创 第6周项目4成员函数,友元函数和一般函数的区别
#include #include using namespace std; class CPoint { private: double x; double y; public: CPoint(double xx = 0, double yy = 0) : x(xx), y(yy){} friend double distance1(CPoint &, CPoint &); dou
2015-04-16 20:12:47
344
原创 第6周项目3-人数不定的工资类
#include using namespace std; class Salary { public: Salary(int n); //n为职工人数,初始化时完成空间的分配 ~Salary(); //析构函数中释放初始化时分配的空间 void input_salary(); void show_salary(); private:
2015-04-15 09:16:19
286
原创 第6周项目2-我的数组类
#include using namespace std; class MyArray { private: int *arrayAddr; //保存一个有len个整型元素的数组的首地址 int len; //记录动态数组的长度 int max; //动态数组中的最大值(并非动态数组中必须要的数据成员) public: My
2015-04-15 09:04:28
272
原创 第6周项目1-深复制体验(增加复制构造函数)
#include #include using namespace std; class A { private: char *a; public: A(A &b) { a=b.a; } A(char *aa) { a=new char[strlen(aa)+1];
2015-04-15 08:39:54
307
原创 第5周项目2-对象作为数据成员
#include #include using namespace std; class CPoint { private: double x; // 横坐标 double y; // 纵坐标 public: CPoint(double xx=0,double yy=0); double Distance1(CPoint p) const; //两点之间的距离(一点是当前点
2015-04-08 17:38:34
289
原创 第5周项目1-体验常成员函数
#include #include using namespace std; class CPoint { private: double x; // 横坐标 double y; // 纵坐标 public: CPoint(double xx=0,double yy=0); double Distance1(CPoint p) const; //两点之间
2015-04-08 08:27:32
318
原创 第4周项目4—指向学生类的指针
#include using namespace std; class Student { public: Student(int n,double s):num(n),score(s) {} void display(); int getNum() { return num; } double getScore() {
2015-04-02 21:32:55
378
原创 第4周项目3-用对象数组操作长方体类
#include #include using namespace std; class Bulk { public: void get_value(); void output(); Bulk(double ,double,double); private: double length,width,heigh; }; Bulk::Bulk(doub
2015-04-01 18:08:28
386
原创 第4周项目1-三角形类的构造函数
#include #include using namespace std; class Triangle { public: Triangle(double x=1,double y=1,double z=1):a(x),b(y),c(z){}; double perimeter(); double area(); void showMess
2015-04-01 09:24:01
315
原创 第4周项目2-分数类的雏形
#include using namespace std; int gcd(int m,int n); class CFraction { private: int nume; int deno; public: CFraction(int nu=0,int de=1); void set(int nu=0,int de=1); vo
2015-04-01 09:09:21
276
原创 第3周项目2—求三角型面积和周长(2)
/* *Copyright (c) 2014 ,烟台大学计算机学院 *All right reserved. *文件名称:求三角型面积和周长(2).cpp *作 者:王伟诚 *完成日期:2015年3月25日 *版 本 号:1.0 * *问题描述:求三角型面积和周长 *问题输出:三角型面积和周长 */ #include #includ
2015-03-25 09:02:19
529
原创 第三周项目1—求三角形周长面积
/* *Copyright (c) 2014 ,烟台大学计算机学院 *All right reserved. *文件名称:求三角形周长面积.cpp *作 者:王伟诚 *完成日期:2015年3月25日 *版 本 号:1.0 * *问题描述:求三角形周长面积*问题输出:三角形的周长和面积*/ #include #include using namespace std; clas
2015-03-25 08:29:06
585
原创 第二周项目4—图书馆的书
/* *Copyright (c) 2014 ,烟台大学计算机学院 *All right reserved. *文件名称:图书馆的书.cpp *作 者:王伟诚 *完成日期:2015年3月18日 *版 本 号:1.0 * *问题描述:图书馆的书*问题输出:图书馆的书*/ #include #include using namespace std; class Book
2015-03-18 09:32:58
359
原创 第二周项目3—时间类
/* *Copyright (c) 2014 ,烟台大学计算机学院 *All right reserved. *文件名称:时间类.cpp *作 者:王伟诚 *完成日期:2015年3月18日 *版 本 号:1.0 * *问题描述:时间类*问题输出:时间*/ #include using namespace std; class Time { public: i
2015-03-18 08:55:44
299
原创 第二周项目2—求长方体体积和表面积
/* *Copyright (c) 2014 ,烟台大学计算机学院 *All right reserved. *文件名称:求长方体体积和表面积.cpp *作 者:王伟诚 *完成日期:2015年3月17日 *版 本 号:1.0 * *问题描述:求长方体体积和表面积*问题输出:长方体体积和表面积*/ #include #include using namespa
2015-03-17 12:09:56
854
原创 第二周项目1—求旱冰场造价
/* *Copyright (c) 2014 ,烟台大学计算机学院 *All right reserved. *文件名称:求旱冰场的造价.cpp *作 者:王伟诚 *完成日期:2015年3月17日 *版 本 号:1.0 * *问题描述:求旱冰场的造价 *问题输出:旱冰场的造价 */ #include #include us
2015-03-17 11:29:34
307
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人