Question: Problem: Write a piece of code that given an STL (standard template library) stack of doubles, it will remove the negative entries from the stack.

Problem: Write a piece of code that given an STL (standard template library) stack of doubles, it will remove the negative entries from the stack. The order of the remaining entries must be preserved.

Header code:

Problem: Write a piece of code that given an STL (standard template

template struct nodeType T data nodeType class myLL public: myLL(); //the default constructor void insert (T) //insert at the beginning of the list void print(); void inserts(T x); //insert x immediately before the first element that is bigger than x int getSize() { return size; } bool isEmpty() return head--nullptr;) bool remove(T) //remove the first occurrence of the specified element bool search (Tx); //returns true if x is in the list; void split(myLL &L1, myLL&L2); //splits the list into two lists L1 and L2 //where L1 is contains the first size/2 elements, // and the second list contains the rest of the elements //at the end of the operation the original list must be empty // e.g. if the original 1ist L-(21,1,12,34,56, /1 then after the operation L-, L1-(21,1,12), L2-(34,56) int numPosElements() //returns the number of elements for which the field data>e /ote this will only work for those list that the comparison data? is defined private: nodeType

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 Databases Questions!