Advertisement
SergeyPGUTI

8.2.1

Feb 18th, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.61 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <string.h>
  4. #include<cstdlib>
  5. #include<ctime>
  6.  
  7. using namespace std;
  8.  
  9.  
  10.  
  11. int main()
  12. {
  13.     int n,m;
  14.     srand((unsigned)time(0));
  15.     cin>>n;
  16.     cin>>m;
  17.     int **p= new int*[n];
  18.  
  19.     for (int i=0;i<n;i++)
  20.     {
  21.         p[i]=new int[m];
  22.     }
  23.  
  24.     for (int i=0;i<n;i++)
  25.         for (int j=0;j<m;j++)
  26.             p[i][j]=rand()%1000;
  27.  
  28.     for (int i=0;i<n;i++)
  29.     {
  30.  
  31.         for (int j=0;j<m;j++)
  32.             {
  33.                 cout.width(3);
  34.                 cout<<p[i][j]<<" ";
  35.             }
  36.             cout<<endl;
  37.     }
  38.  
  39.     return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement