Class Komplex + STL
komplex.cpp
Go to the documentation of this file.
1 #include "komplex.h"
2 #include <iostream>
3 #include <vector>
4 using namespace std;
5 
6 // Methoden der Klasse Komplex
7 
9  : Komplex(0.0,0.0) // constructor forwarding
10 {}
11 
12 Komplex::Komplex(double re, double im)
13  : _re(re), _im(im)
14 {}
15 
17 {
18  _re += rhs._re;
19  _im += rhs._im;
20  return *this;
21 }
22 
23 // Ende: Methoden der Klasse Komplex
24 // -------------------------------------------------------------------------
25 // Funktionen, welche die Klasse Komplex als Datentyp benutzen
26 
27 ostream& operator<<(ostream& s, const Komplex& rhs)
28 {
29  s << "("<< rhs.Get_re()<< ","<<rhs.Get_im() <<")";
30  return s;
31 }
32 
33 istream& operator>>(istream& s, Komplex& rhs)
34 {
35  double a,b;
36  s >> a >> b;
37  rhs = Komplex(a,b);
38  return s;
39 }
40 
Definition: komplex.h:8
Komplex()
Definition: komplex.cpp:8
double Get_im() const
Definition: komplex.h:49
Komplex & operator+=(const Komplex &rhs)
Definition: komplex.cpp:16
double Get_re() const
Definition: komplex.h:32
ostream & operator<<(ostream &s, const Komplex &rhs)
Definition: komplex.cpp:27
istream & operator>>(istream &s, Komplex &rhs)
Definition: komplex.cpp:33