Advertisement
Guest User

Untitled

a guest
Mar 24th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. int x,y;
  5. class Matrix {
  6. private:
  7. int sizeY;
  8. int sizeX;
  9.  
  10. public:
  11. int **array;
  12. Matrix( int sizeY, int sizeX) {
  13. cout << "KONSTRUKTOR" << endl;
  14. this->sizeY = sizeY;
  15. this->sizeX = sizeX;
  16.  
  17. array = new int *[sizeX];
  18.  
  19. for (int i = 0; i < sizeX; i++) {
  20. array[i] = new int [sizeX];
  21. }
  22. cout << "ROZMIARY TABLICY: X,Y " << sizeX << "," << sizeY << endl;
  23. cout << "PRINT STWORZONEJ TABLICY" << endl;
  24.  
  25. for (int i = 0; i < sizeX; i++) {
  26. for (int j = 0; j < sizeY; j++) {
  27. array[i][j]=1 ;
  28. cout << array[i][j] << " ";
  29. }
  30. cout << endl;
  31. }
  32.  
  33.  
  34. }
  35.  
  36. ~Matrix() {
  37. cout << "DESTRUKTOR" << endl;
  38. for (int i = 0; i < sizeX; i++) {
  39.  
  40. delete[] array[i];
  41. }
  42. delete[] array;
  43. }
  44.  
  45.  
  46. };
  47. inline int dodawanko(Matrix,Matrix){
  48. for(int i=0;i< x;i++){
  49. for(int j=0;j<y;j++){
  50. a[i][j]=a[i][j]+b[i][j];
  51. }
  52. }
  53.  
  54.  
  55.  
  56.  
  57. }
  58. int main(){
  59.  
  60. cin>>x;
  61. cin>>y;
  62. Matrix a(x,y);
  63. Matrix b(y,x);
  64. dodawanko(a,b);
  65.  
  66. return 0;
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement