SlideShare a Scribd company logo
1 of 4
Download to read offline
File Type: cpp
Add the following to your linked list of strings program:
1. allow the user to search for an item (indicate the result of the search)
2. allow the user to insert an item (print the linked list after insertion)
3. allow the user to delete an item (print the linked list after deletion)
Here's the program I need to have remodified for this assignment as shown below.
#include
#include
#include
using namespace std;
int main()
{
struct nodeType
{
string info;
nodeType *link;
};
nodeType *first, *newNode, *last;
string x; //string input variable
cout << "Enter a string of some kind. Enter 'Done' when finished." << endl;
getline(cin, x);
first = NULL;
last = NULL;
while (x != "Done")
{
newNode = new nodeType;
newNode->info = x;
newNode->link = NULL;
if (first == NULL)
{
first = newNode;
last = newNode;
}
else
{
last->link = newNode;
last = newNode;
}
cout << newNode->info << " ";
cout << "Enter a string of some kind. Enter 'Done' when finished." << endl;
getline(cin, x);
}
return 0;
}
Solution
In the main function, you need to enter the following:
main()
{
int ch, nodes, ele, posi;
sin_llist sl;
start = NULL;
while(1)
{
cout<<"1.Search for an item"<>ch;
switch(ch)
{
case 1:
cout<<"Searching an item:"<>val;
struct node *z;
z = start;
while (z != NULL)
{
posi++;
if (z->info == val)
{
flag = true;
cout<<"Element "<next;
}
if (!flag)
cout<<"Element "<>y;
struct node *tem, *k;
temp = create_node(y);
if (start == NULL)
{
start = tem;
start->next = NULL;
}
else
{
k = start;
start = tem;
start->next = k;
}
cout<<"Element Inserted at beginning"<>posi;
struct node *z, *ptr;
z = start;
if (posi == 1)
{
start = z->next;
}
else
{
while (z != NULL)
{
z = z->next;
count++;
}
if (posi > 0 && posi <= count)
{
z = start;
for (i = 1;i < pos;i++)
{
ptr = z;
z = z->next;
}
ptr->next = z->next;
}
else
{
cout<<"Position out of range"<

More Related Content

Similar to File Type cppAdd the following to your linked list of strings pro.pdf

C++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdf
C++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdfC++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdf
C++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdfpoblettesedanoree498
 
This assignment and the next (#5) involve design and development of a.pdf
This assignment and the next (#5) involve design and development of a.pdfThis assignment and the next (#5) involve design and development of a.pdf
This assignment and the next (#5) involve design and development of a.pdfEricvtJFraserr
 
Write an algorithm that reads a list of integers from the keyboard, .pdf
Write an algorithm that reads a list of integers from the keyboard, .pdfWrite an algorithm that reads a list of integers from the keyboard, .pdf
Write an algorithm that reads a list of integers from the keyboard, .pdfArrowdeepak
 
Implementation File- -------------------------------------------------.docx
Implementation File- -------------------------------------------------.docxImplementation File- -------------------------------------------------.docx
Implementation File- -------------------------------------------------.docxRyanEAcTuckern
 
Please help solve this in C++ So the program is working fin.pdf
Please help solve this in C++ So the program is working fin.pdfPlease help solve this in C++ So the program is working fin.pdf
Please help solve this in C++ So the program is working fin.pdfankit11134
 
In C++ please, do not alter node.hStep 1 Inspect the Node.h file.pdf
In C++ please, do not alter node.hStep 1 Inspect the Node.h file.pdfIn C++ please, do not alter node.hStep 1 Inspect the Node.h file.pdf
In C++ please, do not alter node.hStep 1 Inspect the Node.h file.pdfstopgolook
 
Lab Week 2 Game Programming.docx
Lab Week 2 Game Programming.docxLab Week 2 Game Programming.docx
Lab Week 2 Game Programming.docxteyaj1
 
in c languageTo determine the maximum string length, we need to .pdf
in c languageTo determine the maximum string length, we need to .pdfin c languageTo determine the maximum string length, we need to .pdf
in c languageTo determine the maximum string length, we need to .pdfstopgolook
 
Write a program to implement below operations with both singly and d.pdf
Write a program to implement below operations with both singly and d.pdfWrite a program to implement below operations with both singly and d.pdf
Write a program to implement below operations with both singly and d.pdfthangarajarivukadal
 
cpp-streams.ppt,C++ is the top choice of many programmers for creating powerf...
cpp-streams.ppt,C++ is the top choice of many programmers for creating powerf...cpp-streams.ppt,C++ is the top choice of many programmers for creating powerf...
cpp-streams.ppt,C++ is the top choice of many programmers for creating powerf...bhargavi804095
 
In the class we extensively discussed a node class called IntNode in.pdf
In the class we extensively discussed a node class called IntNode in.pdfIn the class we extensively discussed a node class called IntNode in.pdf
In the class we extensively discussed a node class called IntNode in.pdfarjunstores123
 
write recursive function that calculates and returns the length of a.pdf
write recursive function that calculates and returns the length of a.pdfwrite recursive function that calculates and returns the length of a.pdf
write recursive function that calculates and returns the length of a.pdfarpitcomputronics
 
Implement the unsorted single linked list as we did in the class and .pdf
Implement the unsorted single linked list as we did in the class and .pdfImplement the unsorted single linked list as we did in the class and .pdf
Implement the unsorted single linked list as we did in the class and .pdfarihantstoneart
 
How do you stop infinite loop Because I believe that it is making a.pdf
How do you stop infinite loop Because I believe that it is making a.pdfHow do you stop infinite loop Because I believe that it is making a.pdf
How do you stop infinite loop Because I believe that it is making a.pdffeelinggift
 
maincpp Build and procees a sorted linked list of Patie.pdf
maincpp   Build and procees a sorted linked list of Patie.pdfmaincpp   Build and procees a sorted linked list of Patie.pdf
maincpp Build and procees a sorted linked list of Patie.pdfadityastores21
 
Inspect the class declaration for a doubly-linked list node in Node-h-.pdf
Inspect the class declaration for a doubly-linked list node in Node-h-.pdfInspect the class declaration for a doubly-linked list node in Node-h-.pdf
Inspect the class declaration for a doubly-linked list node in Node-h-.pdfvishalateen
 
Write a program that accepts an arithmetic expression of unsigned in.pdf
Write a program that accepts an arithmetic expression of unsigned in.pdfWrite a program that accepts an arithmetic expression of unsigned in.pdf
Write a program that accepts an arithmetic expression of unsigned in.pdfJUSTSTYLISH3B2MOHALI
 
THE CODE HAS A SEGMENTATION FAULT BUT I CANNOT FIND OUT WHERE. NEED .pdf
THE CODE HAS A SEGMENTATION FAULT BUT I CANNOT FIND OUT WHERE. NEED .pdfTHE CODE HAS A SEGMENTATION FAULT BUT I CANNOT FIND OUT WHERE. NEED .pdf
THE CODE HAS A SEGMENTATION FAULT BUT I CANNOT FIND OUT WHERE. NEED .pdffathimahardwareelect
 
#include stdafx.h #include iostream using namespace std;vo.docx
#include stdafx.h #include iostream using namespace std;vo.docx#include stdafx.h #include iostream using namespace std;vo.docx
#include stdafx.h #include iostream using namespace std;vo.docxajoy21
 

Similar to File Type cppAdd the following to your linked list of strings pro.pdf (20)

C++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdf
C++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdfC++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdf
C++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdf
 
This assignment and the next (#5) involve design and development of a.pdf
This assignment and the next (#5) involve design and development of a.pdfThis assignment and the next (#5) involve design and development of a.pdf
This assignment and the next (#5) involve design and development of a.pdf
 
Write an algorithm that reads a list of integers from the keyboard, .pdf
Write an algorithm that reads a list of integers from the keyboard, .pdfWrite an algorithm that reads a list of integers from the keyboard, .pdf
Write an algorithm that reads a list of integers from the keyboard, .pdf
 
Implementation File- -------------------------------------------------.docx
Implementation File- -------------------------------------------------.docxImplementation File- -------------------------------------------------.docx
Implementation File- -------------------------------------------------.docx
 
Please help solve this in C++ So the program is working fin.pdf
Please help solve this in C++ So the program is working fin.pdfPlease help solve this in C++ So the program is working fin.pdf
Please help solve this in C++ So the program is working fin.pdf
 
In C++ please, do not alter node.hStep 1 Inspect the Node.h file.pdf
In C++ please, do not alter node.hStep 1 Inspect the Node.h file.pdfIn C++ please, do not alter node.hStep 1 Inspect the Node.h file.pdf
In C++ please, do not alter node.hStep 1 Inspect the Node.h file.pdf
 
Lab Week 2 Game Programming.docx
Lab Week 2 Game Programming.docxLab Week 2 Game Programming.docx
Lab Week 2 Game Programming.docx
 
in c languageTo determine the maximum string length, we need to .pdf
in c languageTo determine the maximum string length, we need to .pdfin c languageTo determine the maximum string length, we need to .pdf
in c languageTo determine the maximum string length, we need to .pdf
 
Write a program to implement below operations with both singly and d.pdf
Write a program to implement below operations with both singly and d.pdfWrite a program to implement below operations with both singly and d.pdf
Write a program to implement below operations with both singly and d.pdf
 
cpp-streams.ppt,C++ is the top choice of many programmers for creating powerf...
cpp-streams.ppt,C++ is the top choice of many programmers for creating powerf...cpp-streams.ppt,C++ is the top choice of many programmers for creating powerf...
cpp-streams.ppt,C++ is the top choice of many programmers for creating powerf...
 
In the class we extensively discussed a node class called IntNode in.pdf
In the class we extensively discussed a node class called IntNode in.pdfIn the class we extensively discussed a node class called IntNode in.pdf
In the class we extensively discussed a node class called IntNode in.pdf
 
write recursive function that calculates and returns the length of a.pdf
write recursive function that calculates and returns the length of a.pdfwrite recursive function that calculates and returns the length of a.pdf
write recursive function that calculates and returns the length of a.pdf
 
Implement the unsorted single linked list as we did in the class and .pdf
Implement the unsorted single linked list as we did in the class and .pdfImplement the unsorted single linked list as we did in the class and .pdf
Implement the unsorted single linked list as we did in the class and .pdf
 
Linked list
Linked listLinked list
Linked list
 
How do you stop infinite loop Because I believe that it is making a.pdf
How do you stop infinite loop Because I believe that it is making a.pdfHow do you stop infinite loop Because I believe that it is making a.pdf
How do you stop infinite loop Because I believe that it is making a.pdf
 
maincpp Build and procees a sorted linked list of Patie.pdf
maincpp   Build and procees a sorted linked list of Patie.pdfmaincpp   Build and procees a sorted linked list of Patie.pdf
maincpp Build and procees a sorted linked list of Patie.pdf
 
Inspect the class declaration for a doubly-linked list node in Node-h-.pdf
Inspect the class declaration for a doubly-linked list node in Node-h-.pdfInspect the class declaration for a doubly-linked list node in Node-h-.pdf
Inspect the class declaration for a doubly-linked list node in Node-h-.pdf
 
Write a program that accepts an arithmetic expression of unsigned in.pdf
Write a program that accepts an arithmetic expression of unsigned in.pdfWrite a program that accepts an arithmetic expression of unsigned in.pdf
Write a program that accepts an arithmetic expression of unsigned in.pdf
 
THE CODE HAS A SEGMENTATION FAULT BUT I CANNOT FIND OUT WHERE. NEED .pdf
THE CODE HAS A SEGMENTATION FAULT BUT I CANNOT FIND OUT WHERE. NEED .pdfTHE CODE HAS A SEGMENTATION FAULT BUT I CANNOT FIND OUT WHERE. NEED .pdf
THE CODE HAS A SEGMENTATION FAULT BUT I CANNOT FIND OUT WHERE. NEED .pdf
 
#include stdafx.h #include iostream using namespace std;vo.docx
#include stdafx.h #include iostream using namespace std;vo.docx#include stdafx.h #include iostream using namespace std;vo.docx
#include stdafx.h #include iostream using namespace std;vo.docx
 

More from footworld1

Describe 3 functions of the cellular membrane and how are these func.pdf
Describe 3 functions of the cellular membrane and how are these func.pdfDescribe 3 functions of the cellular membrane and how are these func.pdf
Describe 3 functions of the cellular membrane and how are these func.pdffootworld1
 
Discuss the three main types of intellectual capitalSolutionth.pdf
Discuss the three main types of intellectual capitalSolutionth.pdfDiscuss the three main types of intellectual capitalSolutionth.pdf
Discuss the three main types of intellectual capitalSolutionth.pdffootworld1
 
Describer in detail the innate immune response to both an intercellu.pdf
Describer in detail the innate immune response to both an intercellu.pdfDescriber in detail the innate immune response to both an intercellu.pdf
Describer in detail the innate immune response to both an intercellu.pdffootworld1
 
Describe the difference between tropic and non-tropic hormones.S.pdf
Describe the difference between tropic and non-tropic hormones.S.pdfDescribe the difference between tropic and non-tropic hormones.S.pdf
Describe the difference between tropic and non-tropic hormones.S.pdffootworld1
 
C++ ProgrammingGivenWrite a closest Pair FunctionDeliverable.pdf
C++ ProgrammingGivenWrite a closest Pair FunctionDeliverable.pdfC++ ProgrammingGivenWrite a closest Pair FunctionDeliverable.pdf
C++ ProgrammingGivenWrite a closest Pair FunctionDeliverable.pdffootworld1
 
Can someone explain to me what the learning curve equation (Tn=T1n^.pdf
Can someone explain to me what the learning curve equation (Tn=T1n^.pdfCan someone explain to me what the learning curve equation (Tn=T1n^.pdf
Can someone explain to me what the learning curve equation (Tn=T1n^.pdffootworld1
 
Both influenza virus and (IFV), and Measles Virus (MV) are envel.pdf
Both influenza virus and (IFV), and Measles Virus (MV) are envel.pdfBoth influenza virus and (IFV), and Measles Virus (MV) are envel.pdf
Both influenza virus and (IFV), and Measles Virus (MV) are envel.pdffootworld1
 
All of the following are characteristic to fatigue fracture surfaces.pdf
All of the following are characteristic to fatigue fracture surfaces.pdfAll of the following are characteristic to fatigue fracture surfaces.pdf
All of the following are characteristic to fatigue fracture surfaces.pdffootworld1
 
A cancer biology topic Describte how ChIP (chromatin immunoprecipit.pdf
A cancer biology topic Describte how ChIP (chromatin immunoprecipit.pdfA cancer biology topic Describte how ChIP (chromatin immunoprecipit.pdf
A cancer biology topic Describte how ChIP (chromatin immunoprecipit.pdffootworld1
 
You get a call from a customer who reinstalled Windows on his comput.pdf
You get a call from a customer who reinstalled Windows on his comput.pdfYou get a call from a customer who reinstalled Windows on his comput.pdf
You get a call from a customer who reinstalled Windows on his comput.pdffootworld1
 
You are running the Windows installation setup for Windows 7 on a co.pdf
You are running the Windows installation setup for Windows 7 on a co.pdfYou are running the Windows installation setup for Windows 7 on a co.pdf
You are running the Windows installation setup for Windows 7 on a co.pdffootworld1
 
Write a program to decipher messages encoded using a prefix code, gi.pdf
Write a program to decipher messages encoded using a prefix code, gi.pdfWrite a program to decipher messages encoded using a prefix code, gi.pdf
Write a program to decipher messages encoded using a prefix code, gi.pdffootworld1
 
With the biological species concept, the process of speciation is fre.pdf
With the biological species concept, the process of speciation is fre.pdfWith the biological species concept, the process of speciation is fre.pdf
With the biological species concept, the process of speciation is fre.pdffootworld1
 
Write a class ArrayList that represents an array of integers. Init.pdf
Write a class ArrayList that represents an array of integers. Init.pdfWrite a class ArrayList that represents an array of integers. Init.pdf
Write a class ArrayList that represents an array of integers. Init.pdffootworld1
 
what is the relationship between lnx and 1xSolutionThe relat.pdf
what is the relationship between lnx and 1xSolutionThe relat.pdfwhat is the relationship between lnx and 1xSolutionThe relat.pdf
what is the relationship between lnx and 1xSolutionThe relat.pdffootworld1
 
Which of these conclusions is supported by plant phylogenies (evolut.pdf
Which of these conclusions is supported by plant phylogenies (evolut.pdfWhich of these conclusions is supported by plant phylogenies (evolut.pdf
Which of these conclusions is supported by plant phylogenies (evolut.pdffootworld1
 
Who are some other individuals who might want to use the informa.pdf
Who are some other individuals who might want to use the informa.pdfWho are some other individuals who might want to use the informa.pdf
Who are some other individuals who might want to use the informa.pdffootworld1
 
Which account below is not a subdivision of owners equityAccumu.pdf
Which account below is not a subdivision of owners equityAccumu.pdfWhich account below is not a subdivision of owners equityAccumu.pdf
Which account below is not a subdivision of owners equityAccumu.pdffootworld1
 
What is the nucleoid region of a prokaryotic cell a membrane bound .pdf
What is the nucleoid region of a prokaryotic cell  a membrane bound .pdfWhat is the nucleoid region of a prokaryotic cell  a membrane bound .pdf
What is the nucleoid region of a prokaryotic cell a membrane bound .pdffootworld1
 
What is heartwood What is sapwood What is the most abundant tissu.pdf
What is heartwood  What is sapwood  What is the most abundant tissu.pdfWhat is heartwood  What is sapwood  What is the most abundant tissu.pdf
What is heartwood What is sapwood What is the most abundant tissu.pdffootworld1
 

More from footworld1 (20)

Describe 3 functions of the cellular membrane and how are these func.pdf
Describe 3 functions of the cellular membrane and how are these func.pdfDescribe 3 functions of the cellular membrane and how are these func.pdf
Describe 3 functions of the cellular membrane and how are these func.pdf
 
Discuss the three main types of intellectual capitalSolutionth.pdf
Discuss the three main types of intellectual capitalSolutionth.pdfDiscuss the three main types of intellectual capitalSolutionth.pdf
Discuss the three main types of intellectual capitalSolutionth.pdf
 
Describer in detail the innate immune response to both an intercellu.pdf
Describer in detail the innate immune response to both an intercellu.pdfDescriber in detail the innate immune response to both an intercellu.pdf
Describer in detail the innate immune response to both an intercellu.pdf
 
Describe the difference between tropic and non-tropic hormones.S.pdf
Describe the difference between tropic and non-tropic hormones.S.pdfDescribe the difference between tropic and non-tropic hormones.S.pdf
Describe the difference between tropic and non-tropic hormones.S.pdf
 
C++ ProgrammingGivenWrite a closest Pair FunctionDeliverable.pdf
C++ ProgrammingGivenWrite a closest Pair FunctionDeliverable.pdfC++ ProgrammingGivenWrite a closest Pair FunctionDeliverable.pdf
C++ ProgrammingGivenWrite a closest Pair FunctionDeliverable.pdf
 
Can someone explain to me what the learning curve equation (Tn=T1n^.pdf
Can someone explain to me what the learning curve equation (Tn=T1n^.pdfCan someone explain to me what the learning curve equation (Tn=T1n^.pdf
Can someone explain to me what the learning curve equation (Tn=T1n^.pdf
 
Both influenza virus and (IFV), and Measles Virus (MV) are envel.pdf
Both influenza virus and (IFV), and Measles Virus (MV) are envel.pdfBoth influenza virus and (IFV), and Measles Virus (MV) are envel.pdf
Both influenza virus and (IFV), and Measles Virus (MV) are envel.pdf
 
All of the following are characteristic to fatigue fracture surfaces.pdf
All of the following are characteristic to fatigue fracture surfaces.pdfAll of the following are characteristic to fatigue fracture surfaces.pdf
All of the following are characteristic to fatigue fracture surfaces.pdf
 
A cancer biology topic Describte how ChIP (chromatin immunoprecipit.pdf
A cancer biology topic Describte how ChIP (chromatin immunoprecipit.pdfA cancer biology topic Describte how ChIP (chromatin immunoprecipit.pdf
A cancer biology topic Describte how ChIP (chromatin immunoprecipit.pdf
 
You get a call from a customer who reinstalled Windows on his comput.pdf
You get a call from a customer who reinstalled Windows on his comput.pdfYou get a call from a customer who reinstalled Windows on his comput.pdf
You get a call from a customer who reinstalled Windows on his comput.pdf
 
You are running the Windows installation setup for Windows 7 on a co.pdf
You are running the Windows installation setup for Windows 7 on a co.pdfYou are running the Windows installation setup for Windows 7 on a co.pdf
You are running the Windows installation setup for Windows 7 on a co.pdf
 
Write a program to decipher messages encoded using a prefix code, gi.pdf
Write a program to decipher messages encoded using a prefix code, gi.pdfWrite a program to decipher messages encoded using a prefix code, gi.pdf
Write a program to decipher messages encoded using a prefix code, gi.pdf
 
With the biological species concept, the process of speciation is fre.pdf
With the biological species concept, the process of speciation is fre.pdfWith the biological species concept, the process of speciation is fre.pdf
With the biological species concept, the process of speciation is fre.pdf
 
Write a class ArrayList that represents an array of integers. Init.pdf
Write a class ArrayList that represents an array of integers. Init.pdfWrite a class ArrayList that represents an array of integers. Init.pdf
Write a class ArrayList that represents an array of integers. Init.pdf
 
what is the relationship between lnx and 1xSolutionThe relat.pdf
what is the relationship between lnx and 1xSolutionThe relat.pdfwhat is the relationship between lnx and 1xSolutionThe relat.pdf
what is the relationship between lnx and 1xSolutionThe relat.pdf
 
Which of these conclusions is supported by plant phylogenies (evolut.pdf
Which of these conclusions is supported by plant phylogenies (evolut.pdfWhich of these conclusions is supported by plant phylogenies (evolut.pdf
Which of these conclusions is supported by plant phylogenies (evolut.pdf
 
Who are some other individuals who might want to use the informa.pdf
Who are some other individuals who might want to use the informa.pdfWho are some other individuals who might want to use the informa.pdf
Who are some other individuals who might want to use the informa.pdf
 
Which account below is not a subdivision of owners equityAccumu.pdf
Which account below is not a subdivision of owners equityAccumu.pdfWhich account below is not a subdivision of owners equityAccumu.pdf
Which account below is not a subdivision of owners equityAccumu.pdf
 
What is the nucleoid region of a prokaryotic cell a membrane bound .pdf
What is the nucleoid region of a prokaryotic cell  a membrane bound .pdfWhat is the nucleoid region of a prokaryotic cell  a membrane bound .pdf
What is the nucleoid region of a prokaryotic cell a membrane bound .pdf
 
What is heartwood What is sapwood What is the most abundant tissu.pdf
What is heartwood  What is sapwood  What is the most abundant tissu.pdfWhat is heartwood  What is sapwood  What is the most abundant tissu.pdf
What is heartwood What is sapwood What is the most abundant tissu.pdf
 

Recently uploaded

Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community PartnershipsSpring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community Partnershipsexpandedwebsite
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppCeline George
 
The Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFThe Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFVivekanand Anglo Vedic Academy
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjMohammed Sikander
 
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...Nguyen Thanh Tu Collection
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................MirzaAbrarBaig5
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...Nguyen Thanh Tu Collection
 
How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17Celine George
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSAnaAcapella
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...Nguyen Thanh Tu Collection
 
ANTI PARKISON DRUGS.pptx
ANTI         PARKISON          DRUGS.pptxANTI         PARKISON          DRUGS.pptx
ANTI PARKISON DRUGS.pptxPoojaSen20
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsSandeep D Chaudhary
 
8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital ManagementMBA Assignment Experts
 
Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...EduSkills OECD
 

Recently uploaded (20)

Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community PartnershipsSpring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
 
OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...
 
Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio App
 
The Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFThe Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDF
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
 
How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
ANTI PARKISON DRUGS.pptx
ANTI         PARKISON          DRUGS.pptxANTI         PARKISON          DRUGS.pptx
ANTI PARKISON DRUGS.pptx
 
ESSENTIAL of (CS/IT/IS) class 07 (Networks)
ESSENTIAL of (CS/IT/IS) class 07 (Networks)ESSENTIAL of (CS/IT/IS) class 07 (Networks)
ESSENTIAL of (CS/IT/IS) class 07 (Networks)
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management
 
Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...
 
VAMOS CUIDAR DO NOSSO PLANETA! .
VAMOS CUIDAR DO NOSSO PLANETA!                    .VAMOS CUIDAR DO NOSSO PLANETA!                    .
VAMOS CUIDAR DO NOSSO PLANETA! .
 
Including Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdfIncluding Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdf
 
Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"
 

File Type cppAdd the following to your linked list of strings pro.pdf

  • 1. File Type: cpp Add the following to your linked list of strings program: 1. allow the user to search for an item (indicate the result of the search) 2. allow the user to insert an item (print the linked list after insertion) 3. allow the user to delete an item (print the linked list after deletion) Here's the program I need to have remodified for this assignment as shown below. #include #include #include using namespace std; int main() { struct nodeType { string info; nodeType *link; }; nodeType *first, *newNode, *last; string x; //string input variable cout << "Enter a string of some kind. Enter 'Done' when finished." << endl; getline(cin, x); first = NULL; last = NULL; while (x != "Done") { newNode = new nodeType; newNode->info = x; newNode->link = NULL; if (first == NULL) { first = newNode; last = newNode; }
  • 2. else { last->link = newNode; last = newNode; } cout << newNode->info << " "; cout << "Enter a string of some kind. Enter 'Done' when finished." << endl; getline(cin, x); } return 0; } Solution In the main function, you need to enter the following: main() { int ch, nodes, ele, posi; sin_llist sl; start = NULL; while(1) { cout<<"1.Search for an item"<>ch; switch(ch) { case 1: cout<<"Searching an item:"<>val; struct node *z; z = start; while (z != NULL)
  • 3. { posi++; if (z->info == val) { flag = true; cout<<"Element "<next; } if (!flag) cout<<"Element "<>y; struct node *tem, *k; temp = create_node(y); if (start == NULL) { start = tem; start->next = NULL; } else { k = start; start = tem; start->next = k; } cout<<"Element Inserted at beginning"<>posi; struct node *z, *ptr; z = start; if (posi == 1) { start = z->next; } else { while (z != NULL) { z = z->next; count++; }
  • 4. if (posi > 0 && posi <= count) { z = start; for (i = 1;i < pos;i++) { ptr = z; z = z->next; } ptr->next = z->next; } else { cout<<"Position out of range"<