Question: point for the console application. / / #include stdafx.h #include #include using namespace std; struct Node { int data; string x; Node * next;
point for the console application.
#include "stdafx.h
#include
#include
using namespace std;
struct Node
int data;
string x;
Node next; it will contain pointer to the next node in the list.
;
class LinkedList
private:
Node head; pointing to the first node in the list
public:
LinkedList
headnullptr;
void insertint data, string b
Node newnode new Node;
newnodedata data;
newnodex b;
newnodenext nullptr;
ifheadnullptr
head newnode;
else
Node temp head;
whiletempnext!nullptr
temp tempnext;
tempnext newnode; this points to last current node in list
void display
Node temp head;
whiletempnullptr
coutdatavalue
head tempnext;
delete temp; to free the memory
whiletempnullptr && tempdata!value
prev temp;
temp tempnext;
iftempnullptrif list is empty
cout"Item is not in the list";
return;
prevnext tempnext;
delete temp;
;
int main
LinkedList l;
linsert "Ahmed";
linsert "bob";
linsert "Ali";
linsert "Moha";
linsert "Abdi";
linsert ali";
cout"Below is the inserted list of Items : ;
ldisplay;
cout
add this to search function and updata function. write c program
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
