Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- struct ellisty
- {
- int klucz;
- ellisty *nast;
- };
- class lista
- {
- ellisty *glowa;
- public:
- lista();
- ~lista();
- bool pusta();
- void dodaj(int klucz);
- void wyswietl();
- };
- lista::lista()
- {
- glowa = NULL;
- }
- bool lista::pusta()
- {
- return (glowa == NULL);
- }
- void lista::dodaj(int klucz)
- {
- struct ellisty *nowy=new struct ellisty;
- nowy->nast = glowa;
- nowy->klucz = klucz;
- glowa = nowy;
- }
- void lista::wyswietl()
- {
- struct ellisty *x = glowa;
- while (x != NULL)
- {
- cout << x->klucz << endl;
- x = x->nast;
- }
- }
- lista::~lista()
- {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement