https://github.com/vedantparanjape/linkedlist-
LinkedList++ is a C++ Linked List templated class library
https://github.com/vedantparanjape/linkedlist-
cplusplus-11 library linkedlist
Last synced: 4 months ago
JSON representation
LinkedList++ is a C++ Linked List templated class library
- Host: GitHub
- URL: https://github.com/vedantparanjape/linkedlist-
- Owner: VedantParanjape
- License: gpl-3.0
- Created: 2017-10-30T09:46:06.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-10-06T17:26:12.000Z (over 4 years ago)
- Last Synced: 2025-01-14T00:49:49.789Z (5 months ago)
- Topics: cplusplus-11, library, linkedlist
- Language: C++
- Homepage:
- Size: 25.4 KB
- Stars: 2
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# LinkedList++
1234
LinkedList++ is a C++ Linked List template class library.
This is a simple plug and play library. There is no need to compile it using cmake or anything. Just include it in your code with correct path and create a class object and use it to store data in a linked list.It has member functions:
```
1. node* createnode(T data) ----- creates a new node and returns its location as pointer to its location, pass data to be stored into it as argument2. LinkedList () ---------------- class constructor
3. void add(T data) ------------- function to add nodes to the linked list
4. T& operator[](int location) -- operator overloaded function to pass node data as a reference, can be used to reassign and extract values
5. void del(int location) ------- function to delete node of linked list
6. int size() ------------------- function to return size of linked list
```
Example code:```
#include "LinkedList++.hpp"
#includeint menu()
{
int option = 0;
system("cls");
std::cout<<"1. Add node \n"
<<"2. Change node data \n"
<<"3. Delete node \n"
<<"4. Show size \n"
<<"5. Show node data \n"
<<"6. Exit \n";
std::cin>>option;
return option;
}int main()
{
LinkedList list;
int loc = 0;
auto data = 0;
do
{
switch(menu())
{
case 1:
std::cout<<"Enter node data: ";
std::cin>>data;
list.add(data);
break;
case 2:
std::cout<<"Enter node location: ";
std::cin>>loc;
std::cout<<"Enter node data: ";
std::cin>>data;
list[loc] = data;
break;
case 3:
std::cout<<"Enter node location: ";
std::cin>>loc;
list.del(loc);
break;
case 4:
std::cout<<"Size of linked list is "<>loc;
std::cout<