Question: I have no clue how to overload the istream& operator >> (istream & input stream, List& destList) or how to insert 10 inbetween 2 and






Submit the solution files of Exereises online before the due date/time. For exereise 1, upload the modified file List.cpp, For exercise 2, upload the modified file Lab7ex2.cpp. Erercise 1. Please download the following files from CANVAS: List.h, List.cpp and Lab7Driver.cpp. In this exercise, you are asked to overload the input operator () for the List class. This should allow us to modify the contents of a list from user input. Let testList be a List object. Then the following expression: dintestitist; should allow the user to input a list of integers from the keyboard, separated by space. The user input can be of arbitrary length, and the user can use any non numerie word to end the input. For example, if the user types 123423234234 end Then testlist would become a List object of size 12 with items: 12.4223234234. The prototype of the overioading function is already added to the Listh file you download from CANVAS. Also, a skeleton of the overloading function implemented is given to you in List.cpp. You just need to fill in the implementation of the function in the designated place. The overloading function is deelared as a friend function of List, thus it could aceess private members of the List class. Note 1: All the previous contents in the List should be overwritten as the result of the input. Note 2: Be very careful about the capacity of the List objectl The user could enter more items than the current capacity of the list. You must expand the capacity of the list whenever you find out there is not enough space to hold the input numbers. Brereise 2. Write a small segment of code to insert a new node into a given linked list. The skeleton code is provided in Lab7ex2.epp from CANVAS. Please follow the instruetions to fill in your code in the correct location in the main 0 function. Submit the modified Lab7ex2.epp. Note Do not write any functions for this task. Use basic pointer operations to add the node. It is strongly suggested you use paper and pen to draw the process of insertion before coding. \#pragma once \#include // Now "ElementType" is "int" class List \{ public: List ( int maxsize =1024);// constructor //Big Three: -List(); // Destructor List(const List\& orig); // Copy Constructor List\& operator= (const List\& orig); // Assignment operator unsigned size() const; bool empty () const; // check if empty void insert(Element Type item, int pos); //insertion void erase(int pos); //deletion void display (ostream\& out) const; //display every item ElementType get(unsigned pos) const; int getCapacity(); I/ over loading function for the input operator friend istream\& operator> (istream\& inputstream, List\& destList); private: int mySize; // current A of i tems in list int myCapacity; 3i ElementType* myArrayPtr; //pointer to dynamic array II overloading function for the input operator istream\& operator (istream\& inputStream, List\& destlist); \#include ciostreams \#include costdlibs \#include "List. h" using namespace std; void List:iinsert(ElementType item, int pos) \{ If (mysize = mycapacity) exit(1); if (pos mysize) return; 1 shift array etements right to make room for item for (int 1= mysize; 1> pos; 1 ) myArrayptr [1]= myArrayptr [11]; // insert item at pos and increase list size myArrayptr [pos] = item; mysizet+; // don't forget this! ) void List: ierase (int pos) \{ If (pos mysize) return; If shift array elements left for (int 1= pos; 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
