-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmaraton_xndir_7.cpp
69 lines (56 loc) · 1.38 KB
/
maraton_xndir_7.cpp
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
#include <iostream>
int ** matrix_number(int** matrix ,const int size = 2)
{
for(int i = 0; i < size; ++i)
{
matrix[i] = new int[size];
}
for(int i = 0; i < size; ++i)
{
for(int j = 0; j < size; ++j)
{
std::cout << "Input Matrix Elem [" << i << "]" << "[" << j << "]:";
std::cin >> matrix[i][j];
}
}
std::cout << "This is my matrix" << std::endl;
for(int i = 0; i < size; ++i)
{
for(int j = 0; j < size; ++j)
{
std::cout << matrix[i][j] << " ";
}
std::cout << std::endl;
}
std::cout << std::endl;
//std::swap(matrix[1][0] , matrix[0][1]);
/*
int convert = 0;
for(int i = 0; i < size; ++i)
{
convert = matrix[size - 1 - i][i];
matrix[size - 1 - i][i] = matrix[i][size - 1 - i];
matrix[i][size - 1 - i] = convert;
}
*/
for(int i = 0; i < size; ++i)
{
for(int j = 0; j < size; ++j)
{
std::cout << matrix[j][size - 1 - i] << " ";
}
std::cout << std::endl;
}
return 0;
}
int main()
{
const int size = 2;
int ** matrix = new int*[size];
matrix_number(matrix,size);
for(int i = 0; i < size; ++i)
{
delete[] matrix[i];
}
delete[]matrix;
}