Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "headers.hpp"
- #include <iostream>
- #include <cstdlib>
- #include <time.h>
- using namespace std;
- double ** renderArr(int m, int n){
- double **arr = new double *[m];
- for(int i=0;i<m;i++)
- arr[i] = new double [n];
- for(int i=0;i<m;i++)
- for(int j=0;j<n;j++)
- arr[i][j] = rand()%10;
- return arr;
- }
- void showArr(int m, int n, double ** arr){
- for(int i=0;i<m;i++){
- for(int j=0;j<n;j++)
- cout<<arr[i][j]<<" ";
- cout<<endl;
- }
- }
- int main()
- {
- srand (time(NULL));
- cout<<endl << "Zwykla tablica" <<endl;
- double **tablica = renderArr( 5, 6 ); //tworzenie tablicy dynamiczna
- showArr(5, 6, tablica);
- cout<<endl << "---Macierze----" <<endl;
- MyMother * a;
- cout<<endl << "Z pustym konstruktorem" <<endl;
- a = new MyMother();
- a->showMyMother();
- cout<<endl << "Z randomowym generowaniem od 0 do 1" <<endl;
- a = new MyMother(3,3, tablica); //przekazanie tablicy na macierz
- a->genRandMother();
- a->showMyMother();
- cout<<endl << "Z przepisaniem z tablicy" <<endl;
- a = new MyMother(5,5,tablica);
- a->showMyMother();
- cout<<endl << "Obciecie wielkosci macierzy" <<endl;
- a->resizeMother(2,2);
- a->showMyMother();
- cout<<endl << "Zwiekszenie wielkosci macierzy" <<endl;
- a->resizeMother(4,4);
- a->showMyMother();
- cout<<endl << "Wiele wiecej ale nie chce mi sie pisac" <<endl;
- cout << "Done!" << endl;
- //delete a;
- MyMother * b;
- MyMother * c;
- b = new MyMother();
- c = new MyMother();
- b->genRandMother();
- c = b;
- b->showMyMother();
- cout << endl;
- c->mother[0][0] = 1;
- c->showMyMother();
- //a = b + c;
- cout << (b == c) << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement