-
Notifications
You must be signed in to change notification settings - Fork 0
/
cmplx.h
45 lines (37 loc) · 776 Bytes
/
cmplx.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <string>
using namespace std;
class Complex
{
private:
double re, im;
public:
Complex(double r=0.0, double i=0.0);
void StrToComp(string);
int CompLen();
double GetRe();
double GetIm();
void StoreComp(Complex);
void SetRe(double);
void SetIm(double);
void Clear();
Complex operator +(Complex);
Complex operator -(Complex);
Complex operator *(Complex);
Complex operator =(Complex);
Complex operator +=(Complex);
template<class T> T from_string(const string& Parameter)
{
T Ergebnis;
stringstream tmp;
tmp << Parameter;
tmp >> Ergebnis;
return Ergebnis;
}
template<class T> string to_string(const T& Parameter)
{
ostringstream tmp;
tmp << Parameter;
return tmp.str();
}
friend ostream &operator <<(ostream &, Complex &);
};