/
oop_nust_misis
/
complex-forthang
Обзор
Документация
Войти
/
oop_nust_misis
/
complex-forthang
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
patch
include/library.hpp
39 строк
1 KB
OOP Nust MISIS
Initial commit
27 мар 2025, 16:19
27 мар 2025, 16:19
ba771aa
Код
Авторство
О чём код?
#ifndef COMPLEX_H #define COMPLEX_H #include <iostream> namespace template_library { class Complex { public: // Конструктор Complex(); Complex(double real, double imag); // Геттеры double real() const; double imag() const; // Арифметические операции Complex operator+(const Complex& other) const; Complex operator-(const Complex& other) const; Complex operator*(const Complex& other) const; Complex operator/(const Complex& other) const; // Умножение комплексного числа на вещественное число friend Complex operator*(double m, const Complex& other); friend Complex operator*(const Complex& other, double m); // Операторы вывода и вывода friend std::ostream& operator<<(std::ostream& os, const Complex& c); friend std::istream& operator>>(std::istream& is, Complex& c); private: double m_real; double m_imag; }; } #endif