switch ( choice ) ase 8: if (start == NULL) { cout<<\"List empty,nothing to disp
ID: 3557355 • Letter: S
Question
switch ( choice )
ase 8:
if (start == NULL)
{
cout<<"List empty,nothing to display"<<endl;
break;
}
dl.display_dlist();
cout<<"Enter your choice from the list : ";
cin>>x;
dl.search_element(x);
cout<<"Enter your second choice from the list : ";
cin>>y;
dl.search_element(y);
if( x == y)
cout<<" The two numbers entered are equal! ";
else
cout<<" The two numbers entered are different! ";
z = x+y;
cout<<" The sum of "<<x<<" and "<<y<<" is "<<z;
cout<<endl;
break;
bool double_llist::search_element(int vlaue)
{
bool found;
struct node *current;
current = start;
while(current != NULL)
{
if(current->info == vlaue )
{
return true;
}
else
cout<<"Element "<<vlaue<<" not on the list"<<endl;
return false;
}
}
This is a doulbe linked list program...
i expect asking the user input 2 elements x,y those are on the list ( if the element not on the list ask enter agian)
for exmaple: output
1. Enter your choice from the list: user enter: 5
2. element 5 is not on the list:
3. Enter your choice from the list: 10
4. Enter your second choice from the list: user enter: 5
5. element 5 is not on the list:
6. Enter your second choice from the list: user enter: 10
7. The two numbers entered are equal!
8. The sum of 10 and 10 is 20.
Explanation / Answer
1. "Link.h" file
LinkList.h" file
"Linklist.h" file
"LinkList_5.cpp" (main program)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.