Advertisement
Guest User

Untitled

a guest
Sep 20th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. #include <cstdlib>
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. int **kop(int **tab,int m,int n)
  7. {
  8. int **wsk=(int**)malloc(sizeof(int*)*m);
  9.  
  10. for(int i=0;i<m;i++)
  11. {
  12. wsk[i]=(int*)malloc(sizeof(float)*n);
  13. for(int j=0;j<n;j++)
  14. wsk[i][j]=tab[i][j];
  15. }
  16. return wsk;
  17. }
  18.  
  19.  
  20. int main(int argc, char *argv[])
  21. {
  22. int n,m;
  23. cout<<"Podaj n i m:";
  24. cin>>m>>n;
  25. int **tab;
  26.  
  27. tab=(int**)malloc(sizeof(int*)*m);
  28.  
  29. for(int i = 0;i<n;i++)
  30. tab[i]=(int*)malloc(sizeof(int)*n);
  31.  
  32. for(int i=0;i<m;i++)
  33. for(int j=0;j<n;j++)
  34. cin>>tab[i][j];
  35.  
  36. int **wsk=kop(tab,m,n);
  37.  
  38. for(int i=0;i<m;i++)
  39. for(int j=0;j<n;j++)
  40. cout<<wsk[i][j];
  41.  
  42. system("PAUSE");
  43. return EXIT_SUCCESS;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement