Home > Back-end >  C problem of emergency
C problem of emergency

Time:09-27

#include
using namespace std;
The class Complex
{
Double real, imag;
Public:
Complex ();
Complex (double r, double I);
Complex plus (const Complex&);
Complex minus (const Complex&);
Complex multiply (const Complex&);
Double getreal ();
Double getimag ();
Void the print ();
};
Complex: : Complex () {}
Complex: : Complex (double r, double I)
: real (r), imag (I) {}
Complex Complex: : plus (const Complex& Second)
{
Return the Complex (real + second. Real, imag + second. Imag);
}
Complex Complex: : minus (const Complex& Second)
{
Return the Complex (real - second. Real, imag - second. Imag);
}
Complex Complex: : multiply (const Complex& Second)
{
Return the Complex (real * second. Real - imag * second. Imag,
Real * second. Imag + imag * second. Real);
}
Double Complex: : getreal ()
{
Return real;
}
Double Complex: : getimag ()
{
Return imag;
}
Void Complex: : print ()
{
Cout & lt; }
The main function of how to write????????????
  • Related