《运算符的重载1》
来源:互联网 发布:新浪 算法工程师 编辑:程序博客网 时间:2024/06/05 10:53
/* (程序头部注释开始)
* 程序的版权和版本声明部分
* Copyright (c) 2011, 烟台大学计算机学院学生
* All rights reserved.
* 文件名称: 流运算符重载
* 作 者: 刘江波
* 完成日期: 2012 年 7 月 2 日
* 版 本 号: v.72
* 对任务及求解方法的描述部分
* 问题描述:
* 程序头部的注释结束
*/
#include<iostream>using namespace std;class Complex{public:friend ostream& operator << (ostream&,Complex&);friend istream& operator >> (istream&,Complex&);private:double real;double imag;};ostream& operator << (ostream& output,Complex& c){output << "(" << c.real << "+" << c.imag << "i)";return output;}istream& operator >> (istream& input,Complex& c){cout << "请输入复数:";input >> c.real >> c.imag;return input;}int main(){Complex c1,c2;cin >> c1 >> c2;cout << "c1=" << c1 <<endl;cout << "c2=" << c2 <<endl;system("PAUSE");return 0;}
- 《运算符的重载1》
- 运算符的重载1
- 运算符的重载1
- 运算符的重载:[],(),->;
- 运算符的重载
- 运算符的重载
- 运算符的重载
- 运算符的重载
- “[]”运算符的重载
- 运算符的重载
- 运算符的重载
- 运算符的重载
- 运算符的重载
- 重载的<<运算符
- 运算符的重载
- 重载的+运算符
- 运算符的重载
- 运算符的重载
- [feature phone系列]GSM网络框架浏览
- 信号(Signal)与槽(Slot)-Qt中的典型机制
- Cannot drop database "databasename" because it is currently in use.
- 通过Partition把map的结果输出到到n个不同的reduce
- UIImage应用与内存管理
- 《运算符的重载1》
- 内存检测
- 解决warning: no newline at end of file
- Handler 机制浅析及Message的异步加载
- 关于Unable to find a 'userdata.img' file for ABI armeabi to copy into the AVD folder的错误
- android单元测试
- 去锁修改屏幕休眠(andorid4.0)
- 作为软件工程师,你必须知道的20个常识
- 一次性移除一个 UIView 所有子视图的方法