fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct macierz {
  5. macierz(size_t w, size_t h): w(w), h(h) { tab = new double[w*h]; }
  6.  
  7. double& operator()(size_t r, size_t c) {
  8. return tab[r*w+c];
  9. }
  10.  
  11. double* tab;
  12. size_t w, h;
  13. };
  14.  
  15. int main() {
  16. macierz* m = new macierz(10, 201);
  17. (*m)(5, 10) = 3.0;
  18. cout << (*m)(5, 10);
  19. return 0;
  20. }
Success #stdin #stdout 0s 3028KB
stdin
Standard input is empty
stdout
3