第4章
文章平均质量分 59
Count104
这个作者很懒,什么都没留下…
展开
-
第4章 第1题
#include using namespace std; class Complex { public: Complex(){real=0;imag=0;} Complex(double r,double i){real=r;imag=i;} double get_real(); double get_imag(); void display(); private:原创 2015-04-27 17:58:00 · 333 阅读 · 0 评论 -
第4章 第2题
#include using namespace std; class Complex { public: Complex(){real=0;imag=0;} Complex(double r,double i){real=r;imag=i;} Complex operator +(Complex &c2); Complex operator -(Complex &c2);原创 2015-04-27 18:04:56 · 346 阅读 · 0 评论 -
第4章 第4题
#include using namespace std; class Matrix { public: Matrix(); friend Matrix operator+(Matrix &,Matrix &); void input(); void display(); private: int mat[2][3]; }; Matrix::Matrix() { for原创 2015-04-27 21:20:02 · 330 阅读 · 0 评论 -
第4章 第7题
#include #include #include using namespace std; class Teacher; class Student { private: int num; string name; string sex; string position; public: Student(){}; Student(int n,string a,st原创 2015-04-27 22:18:51 · 436 阅读 · 0 评论 -
用重载运算符做String
#ifndef _STRING_ #define _STRING_ #include using std::ostream; using std::istream; class String { private: char *s; public: String(); String(int n); String(const char *str); String(const原创 2015-04-27 22:40:33 · 404 阅读 · 0 评论 -
第4章 第5题
#include using namespace std; class Matrix { public: friend Matrix operator +(Matrix m1,Matrix m2); friend istream & operator >> (istream &,Matrix &); friend ostream & operator private: in原创 2015-04-27 21:35:30 · 340 阅读 · 0 评论 -
第4章 第3题
#include using namespace std; class Complex { public: Complex(){real=0;imag=0;} Complex(double r,double i){real=r;imag=i;} Complex operator+(Complex &c2); Complex operator+(int &i); friend原创 2015-04-27 18:10:39 · 358 阅读 · 0 评论 -
第4章 第6题
#include using namespace std; class Complex { public: Complex(){real=0;imag=0;} Complex(double r){real=r;imag=0;} Complex(double r,double i){real=r;imag=i;} operator double(){return real;}原创 2015-04-27 21:49:47 · 334 阅读 · 0 评论