CARVIEW |
Select Language
HTTP/2 200
date: Sun, 12 Oct 2025 00:35:24 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
x-frame-options: DENY
x-content-type-options: nosniff
x-xss-protection: 1;mode=block
vary: accept-encoding
cf-cache-status: DYNAMIC
content-encoding: gzip
set-cookie: _csrf-frontend=1521d4218321cfbfb2cce255ddc86429122d660181937628f9a5b70ed9862163a%3A2%3A%7Bi%3A0%3Bs%3A14%3A%22_csrf-frontend%22%3Bi%3A1%3Bs%3A32%3A%22CRrrJJgtDRR_v8Nd8IRRzZr5o6sB1lV5%22%3B%7D; HttpOnly; Path=/
cf-ray: 98d2845eebf54e3d-BLR
linkedList - Pastebin.com
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- struct Para
- {
- int dana;
- Para *nastepna;
- Para(int wartosc):dana(wartosc),nastepna(nullptr)
- {}
- };
- class LinkedList
- {
- public:
- LinkedList():poczatek(nullptr) {};
- void dodaj(int wartosc)
- {
- Para *nowaPara = new Para(wartosc);
- if (poczatek == nullptr)
- {
- poczatek = nowaPara;
- }
- else
- {
- Para *temp = poczatek;
- while (temp->nastepna != nullptr)
- {
- temp = temp->nastepna;
- }
- temp->nastepna = nowaPara;
- }
- }
- int pobierz(int index)
- {
- Para *temp = poczatek;
- int i = 0;
- while (temp != nullptr)
- {
- if (i == index)
- return temp->dana;
- i++;
- temp = temp->nastepna;
- }
- return 0;
- }
- void wyczysc()
- {
- Para *temp = poczatek;
- while (temp != nullptr)
- {
- Para *next = temp->nastepna;
- delete temp;
- temp = next;
- }
- poczatek = nullptr;
- }
- ~LinkedList()
- {
- wyczysc();
- };
- private:
- Para *poczatek;
- };
- int main()
- {
- LinkedList lista;
- lista.dodaj(4);
- lista.dodaj(8);
- cout << "Pierwszy element listy: " << lista.pobierz(0) << endl;
- cout << "Drugi element listy: " << lista.pobierz(1) << endl;
- lista.wyczysc();
- cout << "Pierwszy element listy: " << lista.pobierz(0) << endl;
- cout << "Drugi element listy: " << lista.pobierz(1) << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
-
Free Crypto Method (NEVER SEEN BEFORE)⭐⭐ F
JavaScript | 3 sec ago | 0.25 KB
-
⭐✅ Marketplace Glitch ✅ Working ✅ NEVER SEEN...
JavaScript | 3 sec ago | 0.25 KB
-
📝 MAKE $2500 IN 15 MIN ✅ Working
JavaScript | 8 sec ago | 0.24 KB
-
⭐✅ Swapzone Glitch ✅ Working ⭐⭐ L
JavaScript | 12 sec ago | 0.25 KB
-
⭐✅ Exploit 2500$ in 15 Minutes⭐⭐⭐ E
JavaScript | 12 sec ago | 0.25 KB
-
💵 Make 3000$ in 20 minutes 💵
JavaScript | 18 sec ago | 0.24 KB
-
✅ Make $2500 in 20 minutes⭐⭐⭐ 7
JavaScript | 21 sec ago | 0.25 KB
-
Free Crypto Method (NEVER SEEN BEFORE)⭐⭐ 3
JavaScript | 21 sec ago | 0.25 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand