00001 // QMcBeaver 00002 // 00003 // Constructed by 00004 // 00005 // Michael Todd Feldmann 00006 // and 00007 // David Randall "Chip" Kent IV 00008 // 00009 // Copyright 2000-2. All rights reserved. 00010 // 00011 // drkent@users.sourceforge.net mtfeldmann@users.sourceforge.net 00012 00013 #ifndef Complex_H 00014 #define Complex_H 00015 00016 #include <iostream> 00017 #include <math.h> 00018 00019 using namespace std; 00020 00025 class Complex 00026 { 00027 private: 00028 double re; 00029 double im; 00030 00031 public: 00035 Complex(); 00036 00043 Complex(double re, double im); 00044 00050 Complex(const Complex & rhs); 00051 00057 double real(); 00058 00064 double imaginary(); 00065 00071 void operator=(const Complex & rhs); 00072 00078 void operator=(const double & rhs); 00079 00080 00086 Complex operator+(const Complex & rhs); 00087 00093 Complex operator+(const double & rhs); 00094 00095 00101 Complex operator-(const Complex & rhs); 00102 00108 Complex operator-(const double & rhs); 00109 00115 Complex operator*(const Complex & rhs); 00116 00122 Complex operator*(const double & rhs); 00123 00129 Complex operator/(const Complex & rhs); 00130 00136 Complex conjugate(); 00137 00146 double abs(); 00147 00153 Complex squareroot(); 00154 00158 friend ostream & operator<<(ostream & strm, Complex & c); 00159 }; 00160 00161 #endif