-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConsoleApplication12.cpp
More file actions
114 lines (72 loc) · 1.88 KB
/
ConsoleApplication12.cpp
File metadata and controls
114 lines (72 loc) · 1.88 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#include "pch.h"
#include <iostream>
#include <fstream>
#include "complex.h"
using namespace std;
int main()
{
setlocale(LC_ALL, "rus");
ofstream fout("complex.txt", ios_base::out | ios_base::trunc);
if (fout.is_open())
{
char operation;
complex t;
cout << "Введите значение комплексных чисел" << endl;
cout << "Первое число" << endl << "Реальное: ";
cin >> t.re1;
cout << endl;
cout << "Мнимое: ";
cin >> t.im1;
cout << endl;
cout << "Второе число" << endl << "Реальное: ";
cin >> t.re2;
cout << endl;
cout << "Мнимое: ";
cin >> t.im2;
cout << endl;
do
{
cout << "Какую операцию вы хотите выполнить?(+, -, *, /) " << endl;
cin >> operation;
switch (operation)
{
case '+':
{
t.summ(t.re1, t.im1, t.re2, t.im2);
if (t.sumIm > 0)
{
cout << "Сумма равна " << t.sumRe << "+" << t.sumIm << "i" << endl;
fout << "Сумма равна " << t.sumRe << "+" << t.sumIm << "i";
}
else
{
cout << "Сумма равна " << t.sumRe << t.sumIm << "i" << endl;
fout << "Сумма равна " << t.sumRe << t.sumIm << "i" << endl;
}
break;
}
case '-':
{
break;
}
case '*':
{
break;
}
case '/':
{
break;
}
default:
{
cout << "Операция была введена неправильно" << endl;
}
fout.close();
}
} while (operation != '+' || operation != '-' || operation != '*' || operation != '/');
}
else
cout << "файл не может быть открыт" << endl;
cout << "Нажмите enter для выхода из программы" << endl;
cin.get();
}