Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.38 KB | None | 0 0
  1. //
  2. // Liczbazepsolona cpp
  3. //
  4.  
  5. #include "LiczbaZespolona.h"
  6.  
  7. float LiczbaZespolona::getIm() const {
  8.     return im;
  9. }
  10.  
  11. void LiczbaZespolona::setIm(float im) {
  12.     LiczbaZespolona::im = im;
  13. }
  14.  
  15. float LiczbaZespolona::getRe() const {
  16.     return re;
  17. }
  18.  
  19. void LiczbaZespolona::setRe(float re) {
  20.     LiczbaZespolona::re = re;
  21. }
  22.  
  23. LiczbaZespolona::LiczbaZespolona() {
  24.     std:: cout << "konstruktor bezargumentowy został wywołany" << std::endl;
  25. }
  26.  
  27. LiczbaZespolona::LiczbaZespolona(float im) : im(im) {
  28.     std:: cout << "konstruktor jednoargumentowy został wywołany" << std::endl;
  29. }
  30.  
  31. LiczbaZespolona::LiczbaZespolona(float im, float re) : im(im), re(re) {
  32.     std:: cout << "konstruktor dwuargumentowy został wywołany" << std::endl;
  33.  
  34. }
  35.  
  36. LiczbaZespolona::LiczbaZespolona( const LiczbaZespolona &c ) :re(c.re), im(c.im)
  37. {
  38.     std:: cout << "konstruktor kopiujący został wywołany" << std::endl;
  39.  
  40. }
  41.  
  42. LiczbaZespolona::~LiczbaZespolona() {
  43.     std:: cout << "destruktor został wywołany" << std::endl;
  44. }
  45.  
  46.  
  47. ///// liczba zespolona .h
  48. //
  49. // Created by Natalia Cheba on 15.10.2019.
  50. //
  51.  
  52. #ifndef UNTITLED3_LICZBAZESPOLONA_H
  53. #define UNTITLED3_LICZBAZESPOLONA_H
  54.  
  55.  
  56. class LiczbaZespolona {
  57. public:
  58.     LiczbaZespolona(float im, float re);
  59.  
  60. public:
  61.     LiczbaZespolona();
  62.  
  63.     LiczbaZespolona(float im);
  64.  
  65.     float getIm() const;
  66.  
  67.     void setIm(float im);
  68.  
  69.     float getRe() const;
  70.  
  71.     void setRe(float re);
  72.     LiczbaZespolona( const LiczbaZespolona &c );
  73.  
  74.     virtual ~LiczbaZespolona();
  75.  
  76.  
  77. private:
  78.     float im;
  79.     float re;
  80.  
  81. };
  82.  
  83.  
  84. #endif //UNTITLED3_LICZBAZESPOLONA_H
  85.  
  86. //tablica.h
  87. //
  88. // Created by Natalia Cheba on 15.10.2019.
  89. //
  90. #include "LiczbaZespolona.h"
  91. #ifndef UNTITLED3_TABLICA_H
  92. #define UNTITLED3_TABLICA_H
  93.  
  94.  
  95. class Tablica{
  96. public:
  97.     virtual ~Tablica();
  98.  
  99. private:
  100. public:
  101.     Tablica(std::initializer_list<int> li);
  102.  
  103.  
  104. private:
  105.     int i;
  106. public:
  107.     int getI() const;
  108.  
  109.     int getJ() const;
  110.  
  111. private:
  112.     int j;
  113.     LiczbaZespolona ** dyn;
  114. };
  115.  
  116.  
  117. #endif //UNTITLED3_TABLICA_H
  118.  
  119.  
  120. //tablica.cpp
  121. //
  122. // Created by Natalia Cheba on 15.10.2019.
  123. //
  124.  
  125. #include "Tablica.h"
  126. using namespace std;
  127.  
  128. int Tablica::getI() const {
  129.     return i;
  130. }
  131.  
  132. int Tablica::getJ() const {
  133.     return j;
  134. }
  135.  
  136. Tablica::Tablica(std::initializer_list<int> li) {
  137.     dyn = new LiczbaZespolona[li[0]][li[1]];
  138. }
  139.  
  140. Tablica::~Tablica() {
  141.  
  142. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement