Advertisement
Guest User

Untitled

a guest
Feb 18th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.66 KB | None | 0 0
  1. #include<iostream>
  2. #include<iomanip>
  3. #include <cstdlib>
  4. #include <time.h>
  5. using namespace std;
  6. int main()
  7. {
  8.  
  9.     int x = 10, y = 10;
  10.  
  11.     int **ptr = new int *[x];
  12.     int summa;
  13.  
  14.     for(int i = 0; i<y; i++)
  15.     {
  16.         ptr[i] = new int[y];
  17.     }
  18.     srand(time(0));
  19.    
  20.     for(int j = 0; j<x; j++)
  21.     {
  22.         for(int k = 0; k<y; k++)
  23.        
  24.         {
  25.             int a = rand()%99;
  26.             summa = summa +a;
  27.            
  28.             ptr[j][k] = a;
  29.             cout<<  ptr  [j][k]<<"  " ;
  30.            
  31.            
  32.            
  33.            
  34.         }
  35.         cout <<   " | " << summa << endl;
  36.         cout<<endl;
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement