-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
110 lines (84 loc) · 2.11 KB
/
Copy pathmain.cpp
File metadata and controls
110 lines (84 loc) · 2.11 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
/*
13. Подсчитать, сколько отрицательных элементов в каждой отдельно взятой строке матрицы. Удалить строку, в которой отрицательных элементов больше всего. Поменять местами главную и побочную диагонали
*/
#include <iostream>
#include <fstream>
#include <string>
#include <time.h>
#include "input_helper.h"
#include "matrix_worker.h"
#include "output_helper.h"
using namespace std;
void console()
{
int size = inputSizeConsole();
int matrix[100][100];
inputMatrixConsole(matrix, size);
outputMatrixConsole(matrix, size, size);
processMatrix(matrix, size);
}
void fromFile()
{
cout << "Please, enter path to file: ";
string path;
// getline(cin, path);
cin >> path;
int matrix[100][100];
int size = inputDataFromFile(matrix, path);
if (size != -1)
{
outputMatrixConsole(matrix, size, size);
processMatrix(matrix, size);
}
else
cout << "Cannot read file";
}
void random()
{
srand(time(NULL));
int size = inputSizeRandom();
int matrix[100][100];
inputMatrixRandom(matrix, size);
outputMatrixConsole(matrix, size, size);
processMatrix(matrix, size);
}
void formula()
{
int size = inputSizeConsole();
double matrix[100][100];
inputMatrixFormula(matrix, size);
outputMatrixConsole(matrix, size, size);
processMatrix(matrix, size);
}
int main()
{
Welcome();
bool toQuit = false;
while (!toQuit)
{
int selection = selectInputType();
switch (selection)
{
case 1:
console();
break;
case 2:
fromFile();
break;
case 3:
random();
break;
case 4:
formula();
break;
default:
{
toQuit = true;
cout << "\n\nIt's very sad to see you going. Anyway, have a nice day!\n";
break;
}
}
}
system("pause");
return 1;
}