Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int x,y;
- class Matrix {
- private:
- int sizeY;
- int sizeX;
- public:
- int **array;
- Matrix( int sizeY, int sizeX) {
- cout << "KONSTRUKTOR" << endl;
- this->sizeY = sizeY;
- this->sizeX = sizeX;
- array = new int *[sizeX];
- for (int i = 0; i < sizeX; i++) {
- array[i] = new int [sizeX];
- }
- cout << "ROZMIARY TABLICY: X,Y " << sizeX << "," << sizeY << endl;
- cout << "PRINT STWORZONEJ TABLICY" << endl;
- for (int i = 0; i < sizeX; i++) {
- for (int j = 0; j < sizeY; j++) {
- array[i][j]=1 ;
- cout << array[i][j] << " ";
- }
- cout << endl;
- }
- }
- ~Matrix() {
- cout << "DESTRUKTOR" << endl;
- for (int i = 0; i < sizeX; i++) {
- delete[] array[i];
- }
- delete[] array;
- }
- };
- inline int dodawanko(Matrix,Matrix){
- for(int i=0;i< x;i++){
- for(int j=0;j<y;j++){
- a[i][j]=a[i][j]+b[i][j];
- }
- }
- }
- int main(){
- cin>>x;
- cin>>y;
- Matrix a(x,y);
- Matrix b(y,x);
- dodawanko(a,b);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement