Question: Could someone please help me with this C++ assignment please. Must follow all instructions (pictures) and use starter code (code below). Thank you #include BagInterface.h
Could someone please help me with this C++ assignment please. Must follow all instructions (pictures) and use starter code (code below). Thank you
#include "BagInterface.h"
#include "DoubleLinkedBag.hpp"
#include
#include
#include
using namespace std;
void displayBag(BagInterface* bagPtr)
{
cout getCurrentSize()
vector bagItems = bagPtr->toVector();
int numberOfEntries = (int)bagItems.size();
for (int i = 0; i
{
cout
} // end for
cout
} // end displayBag
void bagTester(BagInterface* bagPtr)
{
cout isEmpty()
string items[] = {"one", "two", "three"};
cout
for (int i = 0; i
{
bagPtr->add(items[i]);
} // end for
displayBag(bagPtr);
cout isEmpty()
cout getCurrentSize()
cout
bagPtr->clear();
cout isEmpty()
cout
for (int i = 0; i
{
bagPtr->add(items[i]);
} // end for
displayBag(bagPtr);
} // end bagTester
int main()
{
BagInterface* bagPtr = nullptr;
bagPtr = new DoubleLinkedBag();
cout
Lab 4 In chapter 4 we learned about linked chains (also called linked lists) that take this form: nullptr "ab" "cd" "ef" "ij" headPtr item next emnext em next item next item next In a linked chain each node points to the next node. For this lab we're going to create a double- linked chain ef tailPh head Ptr Each node in a double-linked chain contains a pointer to the next node and the previous node We'll do this by beginning with the LinkedBag code from the textbook. Step 1 Download and unzip the starter files: main.cpp- A driver program that includes the polymorphic bag tester functions cout
bagTester(bagPtr);
delete bagPtr;
bagPtr = nullptr;
cout
// Keep the console open so we can see the output
cin.ignore();
cin.get();
return 0;
} // end main
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
