This repository was archived by the owner on Apr 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
90 lines (87 loc) · 2.84 KB
/
main.cpp
File metadata and controls
90 lines (87 loc) · 2.84 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
#include <iostream>
#include <string>
#include <algorithm>
#include "myfuncs.cpp"
using namespace std;
int main()
{
while(true)
{
bool repeatable = false;
string ans;
long n;
cout << "Для начала необходимо ввести число n."
<< endl << "Использовать консоль или файл для получения значения?[ф/к] ";
getline(cin, ans);
if (ans == "ф")
n = file_input();
else if (ans == "к")
{
n = console_input();
repeatable = true;
}
else
{
cout << "Выберите одну из предложенных опций посредством введения соответствующей буквы!"
<< endl << endl;
continue;
}
double farengate[n];
cels_to_farenheit(farengate, n);
while (true)
{
ans = "";
cout << "Необходимо выбрать способ вывода данных. Файл или консоль?[ф/к] ";
getline(cin, ans);
if (ans == "ф")
{
file_output(farengate, n);
break;
}
else if (ans == "к")
{
if (n > 20)
{
double to_out[20];
copy(farengate, farengate + 21, to_out);
long part = 20;
console_output(to_out, part);
cout << "..." << endl << endl;
cout << n - 20 << " значений были выведены в файл output.txt для экономии места." << endl;
file_output(farengate, n);
}
else
{
console_output(farengate, n);
}
break;
}
else
{
cout << "Выберите одну из предложенных опций посредством введения соответствующей буквы!"
<< endl << endl;
continue;
}
}
while(true)
{
if (repeatable)
{
cout << "Желаете повторить?[Д/н] ";
ans = "";
getline(cin, ans);
if (ans == "Д" || ans == "д")
break;
else if (ans == "Н" || ans == "н")
return 0;
else
{
cout << "Введите корректный ответ на вопрос!" << endl << endl;
continue;
}
}
return 0;
}
}
return 0;
}