FISH.

//------------------------------//
// COMPLEX.H //
// Beloshenko(c) //
//------------------------------//
//Input-output functions
float InputFloatWithKeyboard();
//Complex class with attributs and metods
class Complex
{
public:
//Attributs
float Real;
float Imaginary;
//Operators
Complex operator+ (const Complex x) const;
Complex operator- (const Complex x) const;
Complex operator* (const Complex x) const;
Complex operator/ (const Complex x) const;
//Metods
void Add(Complex x);
void Sub(Complex x);
void Mul(Complex x);
void Div(Complex x);
};
Complex
Complex::operator+ (const Complex x) const
{
Complex Result;
Result.Real=this->Real + x.Real;
Result.Imaginary=this->Imaginary + x.Imaginary;
return Result;
}
Complex
Complex::operator- (const Complex x) const
{
Complex Result;
Result.Real=this->Real - x.Real;
Result.Imaginary=this->Imaginary - x.Imaginary;
return Result;
}
Complex
Complex::operator* (const Complex x) const
{
Complex Result;
Result.Real=(this->Real)*x.Real -
(this->Imaginary)*x.Imaginary;
Result.Imaginary=(this->Real)*x.Imaginary+
(this->Imaginary)*x.Real;
return Result;
}
Complex
Complex::operator/ (const Complex x) const
{
Complex Result;
Result.Real=((this->Real)*x.Real +
(this->Imaginary)*x.Imaginary)/
(x.Real*x.Real+
x.Imaginary*x.Imaginary);
Result.Imaginary=(x.Real*(this->Imaginary)-
x.Imaginary*(this->Real))/
(x.Real*x.Real+
x.Imaginary*x.Imaginary);
return Result;
}
void
Complex::Add(Complex x)
{
Complex Result;
Result.Real=this->Real;
Result.Imaginary=this->Imaginary;
Result=Result+x;
this->Real=Result.Real;
this->Imaginary=Result.Imaginary;
}
void
Complex::Sub(Complex x)
{
Complex Result;
Result.Real=this->Real;
Result.Imaginary=this->Imaginary;
Result=Result-x;
this->Real=Result.Real;
this->Imaginary=Result.Imaginary;
}
void
Complex::Mul(Complex x)
{
Complex Result;
Result.Real=this->Real;
Result.Imaginary=this->Imaginary;
Result=Result*x;
this->Real=Result.Real;
this->Imaginary=Result.Imaginary;
}
void
Complex::Div(Complex x)
{
Complex Result;
Result.Real=this->Real;
Result.Imaginary=this->Imaginary;
Result=Result/x;
this->Real=Result.Real;
this->Imaginary=Result.Imaginary;
}
FISH.