?? c10-8(vc).cpp
字號:
//本程序適用于VC++ 6.0
#include <iostream.h>
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;
if(c.imag>=0) output<<"+";
output<<c.imag<<"i)";
return output;
}
istream& operator >> (istream& input,Complex& c)
{cout<<"input real part and imaginary part of complex number:";
input>>c.real>>c.imag;
return input;
}
int main()
{Complex c1,c2;
cin>>c1>>c2;
cout<<"c1="<<c1<<endl;
cout<<"c2="<<c2<<endl;
return 0;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -