Advertisement
MeehoweCK

Untitled

Mar 30th, 2020
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.37 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. //#include <string>
  4.  
  5. using namespace std;
  6.  
  7. class czas
  8. {
  9. private:
  10.     int rok;
  11.     int miesiac;
  12.     int dzien;
  13.     string dzien_tygodnia;
  14. public:
  15.     czas();
  16.     czas(int, int, int, string);
  17.     int get_rok();
  18.     int get_miesiac();
  19.     int get_dzien();
  20.     string get_dzien_tygodnia();
  21.     void set_rok(int);
  22.     void set_miesiac(int);
  23.     void set_dzien(int);
  24.     void set_dzien_tygodnia(string);
  25.     void wypisz();
  26. };
  27.  
  28. int czas::get_rok()
  29. {
  30.     return rok;
  31. }
  32.  
  33. int czas:: get_miesiac()
  34. {
  35.     return miesiac;
  36. }
  37.  
  38. int czas:: get_dzien()
  39. {
  40.     return dzien;
  41. }
  42.  
  43. string czas:: get_dzien_tygodnia()
  44. {
  45.     return dzien_tygodnia;
  46. }
  47.  
  48. void czas::set_rok(int r)
  49. {
  50.     rok = r;
  51. }
  52.  
  53. void czas::set_miesiac(int m)
  54. {
  55.     miesiac = m;
  56. }
  57.  
  58. void czas::set_dzien(int d)
  59. {
  60.     dzien = d;
  61. }
  62.  
  63. void czas::set_dzien_tygodnia(string dt)
  64. {
  65.     dzien_tygodnia=dt;
  66. }
  67.  
  68. /* konstruktor:
  69. Nazwa_klasy::Nazwa_klasy([argumenty konstruktora]) : pole1(wartosc1), pole2(wartosc2) (...)
  70. {}
  71. */
  72.  
  73.  
  74. czas:: czas() : rok(2020), miesiac(03), dzien(29), dzien_tygodnia("niedziela")
  75. {
  76. }
  77.  
  78. czas::czas(int r, int m, int d, string dt) : rok(r), miesiac(m), dzien(d), dzien_tygodnia(dt)
  79. {
  80.  
  81. }
  82.  
  83. void czas::wypisz()
  84. {
  85.     // Miejsce na Twój kod
  86. }
  87.  
  88. int main()
  89. {
  90.     czas A(2020,1,1,"niedziela");
  91.  
  92.     A.wypisz();
  93.  
  94.  
  95.     return 0;
  96. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement