-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
65 lines (47 loc) · 2.27 KB
/
main.cpp
File metadata and controls
65 lines (47 loc) · 2.27 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include "stdafx.h"
#include <iostream>
#include "complex.h"
#include <math.h>
using namespace std;
int main()
{
char select = ' ';
Complex *c1 = new Complex; // выделяем память для объектов класса complex.
Complex *c2 = new Complex;
Complex *c3 = new Complex;
double *mod = new double;
print_menu(select); // меню выбора операций
cin >> select;
switch (select)
{
case '+': //операция сложение
c1, c2->EnterComplex(c1, c2);
c3->complexSum(c1, c2);
break;
case '-': // операция вычитание
c1, c2->EnterComplex(c1, c2);
c3->complexSubstraction(c1, c2);
break;
case '*': // операция умножение
c1, c2->EnterComplex(c1, c2);
c3->complexMultiply(c1, c2);
break;
case '/': // операция деление
c1, c2->EnterComplex(c1, c2);
c3->complexDivision(c1, c2);
break;
case 'M': // нахождение модуля комплексного числа
case 'm':
c1->EnterComplex(c1);
c1->complexModulo(c1);
break;
default: // вызов ошибки в случае введения неверного символа.
print_error();
break;
}
system("pause");
delete c1; // удаляем память для объектов класса так как она является динамической.
delete c2;
delete c3;
delete mod;
}