7.12
2015-07-09 16:03
253 查看
#include<iostream> using namespace std; class Container{ public: Container(double r=0,double i=0); friend Container operator+(const Container c1,const Container c2); void print() ; private: double real,imag; }; Container::Container(double r,double i) { real=r; imag=i; } Container operator+(const Container c1,const Container c2) { Container temp; temp.real=c1.real+c2.real; temp.imag=c1.imag+c2.imag; return temp; } void Container::print() { cout<<" ("<<real<<", "<<imag<<") "<<endl; } int main() { Container c1(2.4,3.6),c2(4.1,6.3); Container c; c=c1+c2; c.print(); return 0; }
相关文章推荐
- IOS 手势学习(点击,长按,轻扫,拖拽,旋转,捏合缩放)
- Sybase 分页查询语句
- Sybase 分页查询语句
- Openvswitch使用
- 什么时候使用静态
- iOS判断应用是否首次启动
- C/C++中常用的字符串处理函数和内存字符串函数
- 第一个Object-C类
- appium学习计划
- java静态方法、非静态代码块{}、静态代码块static{}
- swift enum 和OC兼容
- 从Linux服务器下载网站文件
- Jquery之路(一) 笔记
- 算法之匈牙利算法
- 2015.7.9(1000股涨停,未按分段交易中国重工、中国软件减仓失误!补做大智慧、中色股份追高,而后控制仓位预防高开跳水——重新整理分段交易原则)发现中软吸筹率极高
- 体验阿里云SSD云盘+ECS(I/O优化)的性能
- org.apache.commons.fileupload实现文件上传
- 7.11
- sort()排序结构体,从大到小
- PostgreSQL 字符串操作函数[转]