Advertisement
gasaichan

Untitled

Feb 27th, 2017
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.73 KB | None | 0 0
  1. #include <iostream>
  2. #include <Windows.h>
  3. #include <clocale>
  4.  
  5. #define ROWS 3
  6. #define COLS 4
  7.  
  8. using namespace std;
  9.  
  10. void main() {
  11.     setlocale(LC_ALL, "Russian");
  12.  
  13.     int b[ROWS][COLS];
  14.     int a[COLS][ROWS];
  15.  
  16.     for (int i = 0; i < ROWS; i++) {
  17.         for (int j = 0; j < COLS; j++) {
  18.             cin >> b[i][j];
  19.             a[j][i] = b[i][j];
  20.         }
  21.     }
  22.  
  23.     cout << "Исходная матрица" << endl;
  24.  
  25.     for (int i = 0; i < ROWS; i++) {
  26.         for (int j = 0; j < COLS; j++) {
  27.             cout << b[i][j] << " ";
  28.         }
  29.         cout << endl;
  30.     }
  31.  
  32.     cout << "Транспонированная матрица" << endl;
  33.  
  34.     for (int i = 0; i < COLS; i++) {
  35.         for (int j = 0; j < ROWS; j++) {
  36.             cout << a[i][j] << " ";
  37.         }
  38.         cout << endl;
  39.     }
  40.  
  41.     system("PAUSE");
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement