This repository has been archived on 2023-05-13. You can view files and clone it, but cannot push or open issues or pull requests.
mipt_cpp/seminar01_overload/homework/code/complex_test.cpp

38 lines
1.2 KiB
C++
Raw Normal View History

2022-09-01 16:37:41 +03:00
#include <iostream>
#include "complex.h"
using namespace std;
// Тут мы тестируем нашу реализацию комплексных чисел
int main() {
Complex a;
Complex b;
cin >> a >> b;
cout << "a = " << a << endl
<< "b = " << b << endl
<< "a + b = " << a + b << endl
<< "a - b = " << a - b << endl
<< "a * b = " << a * b << endl
<< "a / b = " << a / b << endl
<< "-a = " << -a << endl
<< "+a = " << +a << endl
<< "*a = " << *a << endl
<< "a + 5 = " << a + 5 << endl
<< "5 + a = " << 5 + a << endl
<< "a * 5 = " << a * 5 << endl
<< "5 * a = " << 5 * a << endl
<< "Exp(a) = " << exp(a) << endl
<< "Sin(a) = " << sin(a) << endl
<< "Cos(a) = " << cos(a) << endl
<< "Exp((a + b) / a) * Cos(a - b) = " << exp((a + b) / a) * cos(a - b) << endl;
a += b;
cout << "a += b; a = " << a << endl;
// Оператор = мы не перегружали, но это всё равно работает
b = a;
cout << "b = a; b = " << b << endl;
}