For C++ How do I create the implementation portion of the complex class describe
ID: 3772190 • Letter: F
Question
For C++ How do I create the implementation portion of the complex class described in the complex definition file "complex.h"
The multiplication and division part is really hard.
#ifndef COMPLEX_H
#define COMPLEX_H
class complex {
public:
complex();
complex(double a);
complex(double a,double b);
complex(int a,int b);
void print() const;
void set(double a=0,double b=0);
void set(int a=0,int b=0);
double getReal() const;
double getImag() const;
void get(double&,double&) const;
complex operator* (complex&);
complex operator* (double&);
complex operator*= (complex&);
complex operator*= (double&);
complex operator/ (complex&);
complex operator/= (complex&);
complex operator/= (double);
complex operator/ (double);
void operator= (const complex&);
bool operator== (complex&);
bool operator!=(complex &c);
friend std::istream &operator>> (std::istream &in, complex& c);
friend std::ostream &operator<<(std::ostream &out, complex c);
complex conj() const;
double norm() const;
double modulus() const;
private:
double real;
double imag;
};
#endif // COMPLEX_H
Explanation / Answer
Header file:
Implementation file:
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.