Question
C++ Linked List Program Help Rating all working solution thumbs up! My code is posted below. Assignment Details : My code: #include using namespace std;
C++ Linked List Program Help
Rating all working solution thumbs up! My code is posted below.
Assignment Details:
My code:
#include
using namespace std;
/*Linked List requirements
Finding a node, removing a node, displaying the entire list,
adding at the head.
*/
template
struct node
{
T data;
node
};
template
class llist
{
public:
void search(T item);
private:
node
node
};
/*
template
void llist::search(T item)
{
for (int i = 0; i
{
if(numNodes[i] == item)
return true;
}
return false;
}
*/
int main()
{
/*
llist
ilist.add(100);
ilist.add(200);
ilist.add(50);
ilist.display();
int location = ilist.find(200);
if (location >= 0)
cout
else
cout
location = ilist.find(1000);
if (location >= 0)
cout
else
count
ilist.remove(100);
ilist.remove(800);
ilist.remove(50);
ilist.display();
location = ilist.find(200);
if (location >= 0)
cout
else
cout
location = ilist.find(100);
if (location >= 0)
cout
else
cout
*/
return 0;
}
This assignment will involve creating a linked list class consisting of nodes that will, in addition to the requisite link, contain a piece of data determined by the use of a template. You must support finding a node, removing a node, displaying the entire list, and adding (at the head). You must also implement a destructor, but you do not need to rewrite the copy constructor or the You may assume that all data stored in the linked list will be unique (i.e. if you find a specific key then you will only find it once). Your main body should be as shown below int main () llist ilist; ilist.add (100); ilist.add (200) ilist.add (50) ilist.displayO int location ilist.find (200) if (location >= 0) cout 0) cout = 0) coutStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started