Курсовая работа: Реализация класса для работы с комплексными числами
double im = a.im - b.im;
cout << "Raznost': " << re << " + " << im << "i" << endl;
double f1=sqrt(re*re+im*im);
double f2=re/f1;
double f3=im/f1;
cout << "Trigonom raznost'" << endl;
cout << f1 << "(cos(" << f2 << ") + isin(" << f3 << "))" << endl;
Complex t(re,im);
return t;
}
Complex operator * (Complex &a, Complex &b){
double re = a.re*b.re - a.im*b.im;
double im = a.im*b.re+a.re*b.im;
cout << "Proizvedenie: " << re << " + " << im << "i" << endl;
double f1=sqrt(re*re+im*im);
double f2=re/f1;
double f3=im/f1;
cout << "Trigonom proiz." << endl;
cout << f1 << "(cos(" << f2 << ") + isin(" << f3 << "))" << endl;
Complex t(re,im);
return t;
}
Complex operator / (Complex &a, Complex &b){
if(b.re*b.re+b.im*b.im==0)
{
cout <<"Delenie na 0";
}
else{
double re=(a.re*b.re+a.im+b.im)/(b.re*b.re+b.im*b.im);