Advertisement
Guest User

Untitled

a guest
Dec 16th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. istream& operator>>(istream &we, Data &d)
  2. {
  3. cout << "Podaj dzien: ";
  4. we >> d.m_nDzien;
  5. cout << "Podaj miesiac: ";
  6. we >> d.m_nMiesiac;
  7. cout << "Podaj rok: ";
  8. we >> d.m_nRok;
  9. d.Koryguj();
  10. return we;
  11. }
  12.  
  13. ostream& operator<<(ostream &wy, const Data &d)
  14. {
  15. wy << d.m_nDzien << endl << d.m_nMiesiac << endl << d.m_nRok;
  16. return wy;
  17. }
  18.  
  19.  
  20. include "Napis.h"
  21.  
  22.  
  23.  
  24. using namespace std;
  25.  
  26. Napis::Napis(const char* napis)
  27.  
  28. {
  29. m_nDl = strlen(napis) + 1;
  30. m_pszNapis = new char[m_nDl];
  31. strcpy(m_pszNapis, napis);
  32. }
  33.  
  34. Napis::Napis(const Napis &wzor)
  35. {
  36. m_nDl = wzor.m_nDl;
  37. m_pszNapis = new char[m_nDl];
  38. strcpy(m_pszNapis, wzor.m_pszNapis);
  39. }
  40. Napis::~Napis()
  41. {
  42.  
  43. delete[] m_pszNapis;
  44.  
  45. }
  46. const char * Napis::Zwroc() const
  47. {
  48. return m_pszNapis;
  49. }
  50.  
  51. void Napis::Ustaw(const char * nowy_napis)
  52. {
  53. m_nDl = strlen(nowy_napis) + 1;
  54. m_pszNapis = new char[m_nDl];
  55. strcpy(m_pszNapis, nowy_napis);
  56. }
  57.  
  58. void Napis::Wypisz() const
  59. {
  60. cout << m_pszNapis;
  61. }
  62.  
  63. void Napis::Wpisz()
  64. {
  65. cin >> m_pszNapis;
  66. }
  67.  
  68. int Napis::SprawdzNapis(const char * por_napis) const
  69. {
  70. return strcmp(m_pszNapis, por_napis);
  71. }
  72.  
  73.  
  74.  
  75. ostream & operator << (ostream& wy, const Napis & p)
  76. {
  77. wy << p.m_pszNapis;
  78. return wy;
  79. }
  80.  
  81. istream & operator >> (istream &we, Napis &p)
  82. {
  83. char buf[30];
  84. we >> buf[0];
  85. we.get(buf + 1,29);
  86. p.Ustaw(buf);
  87. we.get();
  88. return we;
  89. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement