
C++
天上飞下一毛雪
弱鸡的冒险之旅,大四找工作狗,我真的真的好菜。。。。博客内容如有侵权或交流讨论,请加微信:jqt1120359293
展开
-
c++ < > == 重载
#include using namespace std; //const int TURE = 1; //const int FALSE = 0; class area { private: double l; double h; public: area(double l1=0,double h1=0); bool operator >(area &temp); bool opera原创 2017-12-21 14:47:37 · 10742 阅读 · 0 评论 -
c++纯虚函数
#include class shape { public: virtual void printArea() =0; }; class Rectangle:public shape //矩形 { private: double l,k,h; public: virtual void printArea() { cout<<"矩形面积="<<l*k*h<<endl; } Re原创 2017-12-14 16:26:53 · 211 阅读 · 0 评论 -
c++ 对象坐标相加重载
#include class point { public: int x,y; point operator ++(); //自加 point operator ++(int); // point operator --(); //自减 point operator --(int); // point operator + (point &a); point原创 2017-12-07 16:44:09 · 1171 阅读 · 0 评论 -
c++
#include using namespace std; class aa { private: int num; int quantity; float price; static float discount; static float sum; static int n; public: aa(int n,int q,float p) { num=n;price=p;原创 2017-12-02 11:22:01 · 228 阅读 · 0 评论 -
2017.12.2 c++作业
//矩阵相加 #include using namespace std; class aa { private: int a[2][3]; public: aa(); aa operator + (aa c1); void display(); }; aa::aa() { for(int i=0;i<2;i++) for(int j=0;j<3;j++) { a[原创 2017-12-02 11:10:21 · 318 阅读 · 0 评论 -
c++ 友元
#include using namespace std; class date; class time; class time { public: time(int ,int ,int ); friend void display(date &d,time &t); private: int hour; int minute; int sec; }; class date { p原创 2017-11-30 16:41:40 · 215 阅读 · 0 评论 -
C++ 求复数 重载+-*/
#include using namespace std; class complex { private: double real; double imag; public: complex(){real=0;imag=0;} complex(double r,double i) { real=r;imag=i; } complex operator +(complex &c2原创 2017-11-30 17:04:04 · 397 阅读 · 0 评论