用C++ 写一个完整的Complex number(复数)用户给出2个数程序计算+-*/ 以下是已有的#include using namespace std;class Complex {private:double a,b; // z = a + bipublic:Complex();Complex( const Complex & right );Complex( double aa,d

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/05 05:18:46
用C++ 写一个完整的Complex number(复数)用户给出2个数程序计算+-*/ 以下是已有的#include using namespace std;class Complex {private:double a,b; // z = a + bipublic:Complex();Complex( const Complex & right );Complex( double aa,d

用C++ 写一个完整的Complex number(复数)用户给出2个数程序计算+-*/ 以下是已有的#include using namespace std;class Complex {private:double a,b; // z = a + bipublic:Complex();Complex( const Complex & right );Complex( double aa,d
用C++ 写一个完整的Complex number(复数)用户给出2个数程序计算+-*/
以下是已有的
#include
using namespace std;
class Complex {
private:
double a,b; // z = a + bi
public:
Complex();
Complex( const Complex & right );
Complex( double aa,double bb );
Complex( double aa );
void set( double aa,double bb );
double getreal() const;
double getim() const;
Complex & operator = ( const Complex & right );
Complex & operator += ( const Complex & right );
Complex & operator -= ( const Complex & right );
Complex & operator *= ( const Complex & right );
bool operator == ( const Complex & right ) const;
bool operator = ( const Complex & right ) const;
bool operator () const; // the unary not operator
Complex operator + ( const Complex & right ) const;
Complex operator - ( const Complex & right ) const;
Complex operator * ( const Complex & right ) const;
Complex operator / ( const Complex & right ) const;
Complex operator - () const; // the unary minus
// input output operators
friend ostream & operator > ( istream & in,Complex & right );
};
// class implementation
int main() {
string e;
while (1){
coute;
if(e[0]== 'q' or e[0]=='Q') break;
return 0;
}

用C++ 写一个完整的Complex number(复数)用户给出2个数程序计算+-*/ 以下是已有的#include using namespace std;class Complex {private:double a,b; // z = a + bipublic:Complex();Complex( const Complex & right );Complex( double aa,d
你是要在以上基础上修改还是推到重写?