kilolilo

matrix

Nov 23rd, 2017
71
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. using namespace std;
  3. void uber(int **a,int n){
  4.     int ch=0;
  5.     for(int i=0;i<n;i++){
  6.         for(int j=0;j<n;j++){
  7.             ch+=1;
  8.             a[i][j]=ch;
  9.         }
  10.     }
  11. }
  12.  
  13. void print(int **a,int n){
  14.     for(int i=0;i<n;i++){
  15.         for(int j=0;j<n;j++){
  16.             cout<<a[i][j]<<"\t";
  17.         }
  18.         cout<<endl<<endl;
  19.     }
  20. }
  21. int main()
  22. {
  23.     int b=10;
  24.     int **ptr = new int *[b];
  25.     for ( int i=0; i<b; i++){
  26.        ptr[i] = new int [b];
  27.        for(int j=0;j<b;j++){
  28.            ptr[i][j]=0;
  29.            }
  30.     }
  31.     uber (ptr,b);
  32.     print (ptr,b);
  33. }
Add Comment
Please, Sign In to add comment