Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <windows.h>
- #include <format>
- using namespace std;
- int main()
- {
- SetConsoleOutputCP(1251);
- int const n{ 4 };
- int i{}, j{};
- int local_var[4]{};
- int R[n][n]{
- {4, 8, 11, 5},
- {2, 12, 9, 14},
- {0, 5, 0, 7},
- {1, 6, 3, 4} };
- cout << "Початкова матриця: " << endl;
- for (i = 0; i < n; i++) {
- for (j = 0; j < n; j++) {
- cout << format("{:5}", R[i][j]);
- }
- cout << endl;
- }
- cout << "Перетворена матриця: " << endl;
- for (i = 0; i < n; i++) {
- if (i == 0) {
- swap(R[i], R[i + 3]);
- }
- for (j = 0; j < n; j++) {
- if (j == 1) {
- swap(R[i][j], R[i][j + 2]);
- }
- cout << format("{:5}", R[i][j]);
- }
- cout << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement