00001 #ifndef COMPLEX_HH 00002 #define COMPLEX_HH 00003 00004 00005 #include <iostream> 00006 #include <cmath> 00007 #include <stdexcept> 00008 #include <fstream> 00009 #include <sstream> 00010 00011 using namespace std; 00012 00013 const double PI=3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593344612847564823378678316527120190914564856692346034861045432664821339360726024914127372458700660631558817488152092096282925409171536436789259036001133053054882046652138414695194151160943305727036575959195309218611738193261179310511854807446237996274956735188575272489122793818301194912; 00014 const double PI_2=PI/2; 00015 00016 00018 00023 class Complex { 00024 float Re; 00025 float Im; 00027 public: 00028 00030 00034 Complex(float re=0, float im=0); 00035 00037 00041 void set(float re,float im); 00042 00044 00047 float getRe(); 00048 00050 00053 float getIm(); 00054 00056 00059 float getM(); 00060 00062 00065 float getFi(); 00066 00068 00071 void Complex::sprzez(); 00072 00074 00077 Complex Complex::sprzezona(); 00078 00080 00083 Complex pierw(); 00084 00086 00089 double _sin(double x); 00091 00094 double _cos(double x); 00095 00096 00098 Complex operator * (const Complex); 00100 Complex operator + (const Complex); 00102 Complex operator - (const Complex); 00104 Complex operator / (const Complex); 00106 bool operator == (const Complex); 00107 bool operator != (Complex f); 00109 Complex operator - (); 00110 00112 Complex operator *= (const Complex); 00114 Complex operator += (const Complex); 00116 Complex operator -= (const Complex); 00118 Complex operator /= (const Complex); 00119 00120 00122 Complex operator * (float); 00124 Complex operator + (float); 00126 Complex operator - (float); 00128 Complex operator / (float); 00130 bool operator == (float); 00131 00132 00134 00138 friend ostream& operator<< (ostream& s, Complex z); 00139 00141 00145 friend istream& operator>> (istream& s, Complex& z); 00146 00148 00151 void Complex::throwError(const string& err) const; 00152 00153 00154 }; 00155 #endif