Question: C + + ! I need you help to Write down the missing code and test it with attached cases? using namespace std; #include #includellist.h

C++! I need you help to Write down the missing code and test it with attached cases?
using namespace std;
#include
#include"llist.h"
llist::llist()
{ cout "... in llist constructor..." endl; }
llist::~llist()
{ cout ".... in llist destructor..." endl; }
//PURPOSE:
//PARAMETER:
bool llist::isEmpty()
{}// be sure to check all 3 data members
//PURPOSE:
//PARAMETER:
void llist::displayAll()
{}// be sure to display horizontally in [] with
// blanks between elements e.g.[1234]
// You MUST use while (P != NULL) loop or you will not get the credit!
//PURPOSE:
//PARAMETER:
void llist::addRear(el_t NewNum)
{}// comment the 2 cases
//PURPOSE:
//PARAMETER:
void llist::addFront(el_t NewNum)
{}// comment the 2 cases
//PURPOSE:
//PARAMETER:
void llist::deleteFront(el_t& OldNum)
{}// comment the 3 cases
//PURPOSE:
//PARAMETER:
void llist::deleteRear(el_t& OldNum)
{}// comment the 3 cases
// Utility Function to move a local pointer to the Jth node
void llist::moveTo(int J, Node*& temp)
{// Note that case1 client does not test this. But it is neede
// for case 2 so make it work perfectly.
// moves temp J-1 times to go to the Jth node (>=1 and = Count is assumed)
// for ( int K =...) temp = temp->Next;
}
/*--- harder ones for case 2 and 3 follow --*/
//PURPOSE:
//PARAMETER:
void llist::deleteIth(int I, el_t& OldNum)
{}// must use moveTo to move local pointers. Be sure to comment to which node you are moving them. Do not forget to set OldNum.
//PURPOSE:
//PARAMETER:
void llist::insertIth(int I, el_t newNum)
{}// must use moveTo to move local pointers. Be sure to comment to which node you are moving them.
//PURPOSE:
//PARAMETER:
llist::llist(const llist& Original)
{}// use my code below
//PURPOSE: This is the copy constructor which copies a list into another.
//PARAMETER: Original - it the variable used to pass the list to be copied.
llist::llist(const llist& Original)
{// use my code
Front = NULL; Rear = NULL; Count =0;
// this-> object has to be built up by allocating new cells withOtherOne elements (**)
Node* P; // local pointer for OtherOne
P = Original.Front;
while (P != NULL)// a loop which repeats until you reach the end of OtherOne.
{
this->addRear(P->Elem); //Ps element is added to this->
P = P->Next; // Go to the next node in OtherOne
}
return *this; // return the result unconditionally. Note that the result is returned by reference.
}// end of if
//PURPOSE:
//PARAMETER:
llist& llist::operator=(const llist& OtherOne)
{
el_t x;
// First make sure this-> and OtherOne are not the same object.
// To do this, compare the pointers to the objects .
if (&OtherOne != this)// if not the same
{
// this-> object has to be emptied first.
while (! this->isEmpty())
this->deleteRear(x);
// this-> object has to be built up by allocating new cells with OtherOne elements (**)
Node* P; // local pointer for OtherOne
P = OtherOne.Front;
while (P != NULL)// a loop which repeats until you reach the end of OtherOne.
{
this->addRear(P->elem); //Ps element is added to this->
P = P->Next; // Go to the next node in OtherOne
}
}// end of if
return *this;
}// use my code above
1.check empty and report the result
2.display the list
L.displayAll();
3.add 4 integers to rear
L.addRear(1); L.addRear(2); L.addRear(3); L.addRear(4
4.display the list
L.displayAll();
-[1234]
5.remove from front twice (and display the elements as they are removed)
6.display the list
7.check empty again and report the result
8.remove from the rear twice (display the elements removed)
9.check empty again and report the result
10.add to front 4 times (elements 9,8,6,5)
11.display the list
12.remove from the rear 4 times (display the elements removed)
13.display the list again
C + + ! I need you help to Write down the missing

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!