Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class macierz{
  5. static const int DEFAULT = 1;
  6. private:
  7. double **tab; //wskaźniki
  8. int m_height; //wysokość macierzy
  9. int m_width; //szerokość macierzy
  10. public:
  11. macierz(); //konstruktor domyślny
  12. };
  13. macierz::macierz(){
  14. m_height = 1;
  15. m_width = 1;
  16. tab = new double*[DEFAULT];
  17. for (int i = 0; i < DEFAULT; ++i )
  18. tab[i] = new double[DEFAULT];
  19. //wpisanie wartości
  20. for (int i = 0; i < m_height; i++)
  21. for (int j = 0; j < m_width; j++)
  22. tab[i][j] = j+1;
  23. //wypisywanie
  24. for (int i = 0; i < m_height; i++){
  25. cout << "\n";
  26. for (int j = 0; j < m_width; j++)
  27. printf("%2g \n", tab[i][j]);
  28. }
  29. }
  30.  
  31. int main(){
  32. macierz a();
  33. macierz kopia_a( a );
  34.  
  35. cout << "\nKoniec programu.\n";
  36. return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement