Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- istream& operator>>(istream &we, Data &d)
- {
- cout << "Podaj dzien: ";
- we >> d.m_nDzien;
- cout << "Podaj miesiac: ";
- we >> d.m_nMiesiac;
- cout << "Podaj rok: ";
- we >> d.m_nRok;
- d.Koryguj();
- return we;
- }
- ostream& operator<<(ostream &wy, const Data &d)
- {
- wy << d.m_nDzien << endl << d.m_nMiesiac << endl << d.m_nRok;
- return wy;
- }
- include "Napis.h"
- using namespace std;
- Napis::Napis(const char* napis)
- {
- m_nDl = strlen(napis) + 1;
- m_pszNapis = new char[m_nDl];
- strcpy(m_pszNapis, napis);
- }
- Napis::Napis(const Napis &wzor)
- {
- m_nDl = wzor.m_nDl;
- m_pszNapis = new char[m_nDl];
- strcpy(m_pszNapis, wzor.m_pszNapis);
- }
- Napis::~Napis()
- {
- delete[] m_pszNapis;
- }
- const char * Napis::Zwroc() const
- {
- return m_pszNapis;
- }
- void Napis::Ustaw(const char * nowy_napis)
- {
- m_nDl = strlen(nowy_napis) + 1;
- m_pszNapis = new char[m_nDl];
- strcpy(m_pszNapis, nowy_napis);
- }
- void Napis::Wypisz() const
- {
- cout << m_pszNapis;
- }
- void Napis::Wpisz()
- {
- cin >> m_pszNapis;
- }
- int Napis::SprawdzNapis(const char * por_napis) const
- {
- return strcmp(m_pszNapis, por_napis);
- }
- ostream & operator << (ostream& wy, const Napis & p)
- {
- wy << p.m_pszNapis;
- return wy;
- }
- istream & operator >> (istream &we, Napis &p)
- {
- char buf[30];
- we >> buf[0];
- we.get(buf + 1,29);
- p.Ustaw(buf);
- we.get();
- return we;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement