#include <iostream.h>
输入输出流,
屏幕输入输出 :
istream
ostream
stdin, stdout stderr
输出操作符<<
输入操作符>>
都可以被重载.
文件输入输出
#include <fstream.h>
ifstream
ofstream
重载的流函数 来输出复数
class Complex
{
friend ostream& operator << (ostream &os, complex&ob);
};
friend ostream& operator << (ostream &os, complex&ob)
{
return os<<ob.Re<<(ob.Im>=0.0)?"+":"-"<<fabs(ob.Im)<<"i";
}