Advertisement
Guest User

Untitled

a guest
Nov 25th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.72 KB | None | 0 0
  1. #include <iostream>
  2. #include <ctime>
  3. #include <cstdlib>
  4. #define M 3
  5. #define N 3
  6. using namespace std;
  7.  
  8. int main()
  9. { srand(time(NULL));
  10.   int tab[M][N];
  11.   int tab2[M][N];
  12.   int pom;
  13.   for(int i=0;i<M;i++)
  14.   {
  15.       for(int j=0;j<N;j++)
  16.       {
  17.         tab[i][j]=rand()%10-5;
  18.       }
  19.   }
  20.    for(int i=0;i<M;i++)
  21.   {
  22.       for(int j=0;j<N;j++)
  23.       {
  24.         cout<<tab[i][j]<<" ";
  25.       }
  26.       cout<<endl;
  27.   }
  28. cout<<endl<<endl;
  29.  
  30.  for(int i=0;i<M;i++)
  31.   {
  32.       for(int j=0;j<N;j++)
  33.       {
  34.         tab2[i][j]=tab[M-1-i][N-1-j];
  35.       }
  36.   }
  37.  
  38.  
  39.      for(int i=0;i<M;i++)
  40.   {
  41.       for(int j=0;j<N;j++)
  42.       {
  43.         cout<<tab2[i][j]<<" ";
  44.       }
  45.       cout<<endl;
  46.   }
  47. cout<<endl<<endl;
  48.  
  49.  
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement