SHARE
TWEET

Untitled

a guest Feb 21st, 2020 114 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <iomanip>
  3.  
  4. using namespace std;
  5.  
  6. int main(){
  7.     int n, m;
  8.     cin>>n;
  9.     cin>>m;
  10.     int arr[n][m];
  11.     for (int i = 0; i < n; i++) {
  12.         for (int j = 0; j < m; j++){
  13.                arr[i][j] = rand()%10;
  14.             }
  15.     }
  16.     for (int i = 0; i < n; i++) {
  17.         for (int j = 0; j < m; j++){
  18.                  cout << setw(4) << arr[i][j];
  19.                 }
  20.     cout << endl;
  21. }
  22.     cout << "\n";
  23.  
  24.     for (int i = 0, j = 0; i < n, j < m; i++, j++){
  25.        
  26.         int a = arr[i][m -1 - j];
  27.         arr[i][m-1-j] = arr[i][j];
  28.         int b = arr[i][m-1-j];
  29.         arr[i][j] = a;
  30.         if (a == b){
  31.             cout << a<< endl;
  32.     };}
  33.    
  34.    
  35.     for (int i = 0; i < n; i++) {
  36.         for (int j = 0; j < m; j++){
  37.                  cout << setw(4) << arr[i][j];
  38.                 }
  39.     cout << endl;}
  40. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top