24 lines
557 B
C++
Executable File
24 lines
557 B
C++
Executable File
class CKomplex {
|
|
private:
|
|
double real;
|
|
double imag;
|
|
|
|
public:
|
|
// Konstruktoren
|
|
CKomplex();
|
|
CKomplex(double a, double b);
|
|
CKomplex(double phi);
|
|
|
|
// Methoden zur Rückgabe des Real- und Imaginärteils
|
|
double re() const;
|
|
double im() const;
|
|
|
|
// Überladene Operatoren für Addition und Multiplikation
|
|
CKomplex operator+(const CKomplex& other) const;
|
|
CKomplex operator-(const CKomplex& other) const;
|
|
CKomplex operator*(const CKomplex& other) const;
|
|
CKomplex operator*(double scalar) const;
|
|
|
|
// Methode zur Berechnung des Betrags
|
|
double abs() const;
|
|
}; |