Question: Main.cpp #include #include #include #include SortedNumberList.h using namespace std; int main ( ) { bool includeRemovals = false; / / Numbers to insert during
Main.cpp
#include
#include
#include
#include "SortedNumberList.h
using namespace std;
int main
bool includeRemovals false;
Numbers to insert during first loop:
vector numbersToInsert
;
Insert each number and print sorted list's contents after each insertion
SortedNumberList list;
cout fixed setprecision;
for auto number : numbersToInsert
cout "List after inserting number : ;
list.Insertnumber;
list.Printcout
;
if includeRemovals
cout endl;
vector numbersToRemove
List's last element
List's first element
Neither first nor last element
Remaining elements:
;
Remove numbers
for auto toRemove : numbersToRemove
cout "List after removing toRemove : ;
list.RemovetoRemove;
list.Printcout
;
return ;
SortedNumberList.h
#ifndef SORTEDNUMBERLISTH
#define SORTEDNUMBERLISTH
#include "NumberList.h
class SortedNumberList : public NumberList
private:
Optional: Add any desired private functions here
public:
SortedNumberList
head nullptr;
tail nullptr;
Inserts the number into the list in the correct position such that the
list remains sorted in ascending order.
void Insertdouble number
TODO: Type your code here
Removes the node with the specified number value from the list. Returns
true if the node is found and removed, false otherwise.
bool Removedouble number
TODO: Type your code here
return false;
;
#endif
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
