00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00026 #include <iostream>
00027 #include "complex.h"
00028
00029 void test01()
00030 {
00031 Complex a;
00032 Complex b (3., 0.);
00033
00034
00035 cout << "b = " << b << "\n";
00036
00037 a = b;
00038 cout << "a = " << a << "\n";
00039
00040
00041 a = Complex (1., 1.);
00042 cout << "a = " << a << "\n";
00043 cout << "a.abs() = " << abs (a) << "\n";
00044 cout << "a.arg()= "<< arg (a)*57.2957914331333 <<" degree"<< "\n";
00045
00046
00047 Complex c;
00048 c = a + b;
00049 cout << "c = " << c << "\n";
00050
00051 cout << "a += b: " << (a += b) << "\n";
00052
00053 cout << "c + 3 = " << (c + 3.) << "\n";
00054
00055 cout << "c + 3i = c + Complex (0,3) = " << (c + Complex (0., 3.)) << "\n";
00056
00057 Complex d;
00058 a = Complex (1., 1.);
00059 b = Complex (-1., -1.);
00060 d = a * b;
00061 cout << "d = " << d << "\n";
00062 Complex e;
00063 e = a / b;
00064 cout << "e = " << e << "\n";
00065 Complex f;
00066 f = pow(a,0)+pow(b,0);
00067 cout << "f = " << f << "\n";
00068 Complex g;
00069 g = pow(a,1)+pow(b,1);
00070 cout << "g = " << g << "\n";
00071 Complex h;
00072 h=pow(a,2)+pow(b,2)+pow(a,3)+pow(b,3);
00073 cout << "h = " << h << "\n";
00074 }
00075
00076 int main()
00077 {
00078 test01();
00079 return 0;
00080 }