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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
| #include <iostream>
#include <iomanip>
#include <functional>
using namespace std;
class iter
{
public:
int count_line;
int count_X;
int** ary;
int* aryB;
int max_x;
int swap;
int** array_generator(unsigned int count_line, unsigned int count_X)
{
int** ptrary = new int* [count_line];
for (int i = 0; i < count_line; i++)
{
ptrary[i] = new int[count_X];
}
return ptrary;
}
void inputArray(int** ary, unsigned int count_line, unsigned int count_X)
{
cout << "Введите элементы массива A " << endl;
for (int i = 0; i < count_line; i++)
{
for (int j = 0; j < count_X ; j++)
{
cout << "X[" << j + 1 << "]=" ;
cin >> ary[i][j];
} cout << endl;
}
}
void printar(int** ary)
{
for (int i = 0; i < count_line; i++)
{
for (int j = 0; j < count_X; j++)
{
cout << ary[i][j] << " ";
} cout << endl;
}
}
void array_destroyer(int** ary, unsigned int count_line)
{
for (int i = 0; i < count_line; i++) {
delete[] ary[i];
}
delete[] ary;
}
int* array_2generator(unsigned int count_line)
{
int* array = new int[count_line];
return array;
}
void input2arr(int* aryB, unsigned int count_line)
{
cout << "Введите элементы массива B " << endl;
for (int i = 0; i < count_line; i++)
{
cout << "= ";
cin >> aryB[i];
}
}
void printar2(int* aryB)
{
for (int i = 0; i < count_line; i++)
{
cout << aryB[i] << " ";
}
cout << endl;
}
void array_destroyer2(int* aryB, unsigned int count_line)
{
delete[] aryB;
}
/*void counteq(int** ary, unsigned int count_X, unsigned int count_line)
{
int temp = 0;
for (int c = 0; c <= (count_X * count_line); c++)//колличество проходов
{
//в строках упорядочиваем
//____________________________________________
for (int i = 0; i < count_X; i++)
{
for (int j = 0; j < count_line - 1; j++)
{
if (ary[i][j] > ary[i][j + 1])
{
temp = ary[i][j];
ary[i][j] = ary[i][j + 1];
ary[i][j + 1] = temp;
}
}
}
}
//Вывод отсорт массива
for (int i = 0; i < count_line; i++)
{
for (int j = 0; j < count_X; j++)
{
cout << ary[i][j] << " ";
} cout << endl;
}
} */
void iterations(int** ary, int* aryB, unsigned int count_line, unsigned int count_X)
{
int x1 = (aryB[0] - ary[0][1] * i - ary[0][2] * i - ary[0][3] * i) / ary[0][0];
int x2 = (aryB[1] - ary[1][0] * i - ary[1][2] * i - ary[1][3] * i) / ary[1][1];
int x3 = (aryB[2] - ary[2][0] * i - ary[2][1] * i - ary[2][3] * i) / ary[2][2];
int x4 = (aryB[3] - ary[3][0] * i - ary[3][1] * i - ary[3][2] * i) / ary[3][3];
}
};
int main()
{
setlocale(LC_ALL, "Russian");
iter first;
first.count_line = 4;
first.count_X = 4;
first.ary = first.array_generator(first.count_line,first.count_X);
first.inputArray(first.ary, first.count_line, first.count_X);
first.printar(first.ary);
first.aryB = first.array_2generator(first.count_line);
first.input2arr(first.aryB, first.count_line);
first.printar2(first.aryB);
//first.counteq(first.ary, first.count_X, first.count_line);
first.array_destroyer(first.ary, first.count_line);
first.array_destroyer2(first.aryB, first.count_line);
system("pause");
} |