Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- const int DIM = 4;
- void printMatrix(long A[][DIM])
- {
- for(int i = 0; i < DIM; i++)
- {
- for(int j = 0; j < DIM; j++){
- cout << A[i][j] << " ";
- }
- cout << endl;
- }
- cout << "\n";
- }
- void shifting(long A[][DIM])
- {
- for(int i = DIM-1; i > 0; i--){
- for(int j = 0; j < DIM; j++)
- {
- int tmp = A[i][j];
- A[i][j] = A[i-1][j];
- A[i-1][j] = tmp;
- }
- }
- }
- int main()
- {
- long A[][DIM] = {{8, 7, 1, 4},
- {5, 6, 9, 3},
- {0, 1, 7, 6},
- {3, 3, 5, 8}};
- printMatrix(A);
- shifting(A);
- printMatrix(A);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement