-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
64 lines (55 loc) · 2.21 KB
/
main.cpp
File metadata and controls
64 lines (55 loc) · 2.21 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
61
62
63
64
#include "stdafx.h"
#include "complex.h"
using namespace std;
int main()
{
setlocale(LC_ALL, "ru");
char select = ' ';
char ch;
Complex c1, c2, c3;
ComplexNew c;
double *mod = new double;
print_menu(select); // меню выбора операций
do {
cin >> select;
switch (select)
{
case '+': //операция сложение
entercomplex();
cin >> c1 >> c2;
c3 = c1 + c2;
cout << c3;
break;
case '-': // операция вычитание
entercomplex();
cin >> c1 >> c2;
c3 = c1 - c2;
cout << c3;
break;
case '*': // операция умножение
entercomplex();
cin >> c1 >> c2;
c3 = c1 * c2;
cout << c3;
break;
case '/': // операция деление
entercomplex();
cin >> c1 >> c2;
c3 = c1 / c2;
cout << c3;
break;
case 'M': // нахождение модуля комплексного числа
case 'm':
cout << "Enter complex number, real imag: "; cin >> c;
c.complexModulo(c);
break;
default: // вызов ошибки в случае введения неверного символа.
print_error();
break;
}
cout << "\nПродолжать (y/n)? ";
cin >> ch;
} while (ch != 'n');
system("pause");
delete mod;
}