Question: THIS IS THE DRIVER DI NOT ALTER. I dint know why my code wont cout the sample givet at the bottom of the code. #include
THIS IS THE DRIVER DI NOT ALTER. I dint know why my code wont cout the sample givet at the bottom of the code.
#include
#include "List.h"
using namespace std;
int main()
{
int orig[] = {6,3,5,1,8,4,7};
List list1(orig, 7, 50);
cout "list1 created from array: " endl;
list1.display(cout);
cout endl;
int orig2[] = {1,5,15,23,3};
List list2(orig2, 5, 5);
cout "list2 created from array: " endl;
list2.display(cout);
cout endl;
cout "Capacity of list2 is " list2.getCapacity() endl;
cout "Change the capacity of list 2 to 50." endl;
list2.ChangeCapacity(50);
cout "After the change of capacity, list2 becomes: " endl;
list2.display(cout); // Should be unchanged, since we change the capacity, not the contents
cout endl;
cout "Inserting more elements to the expanded list2." endl;
for(int i=0; i45; i++){
list2.insert(i,0);
}
cout "After the insertion, list2 becomes: " endl;
list2.display(cout);
// Should be 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 5 15 23 3
cout endl;
}

![code. #include #include "List.h" using namespace std; int main() { int orig[]](https://s3.amazonaws.com/si.experts.images/answers/2024/09/66e1408f2149a_15866e1408eb3893.jpg)

![endl; list1.display(cout); cout endl; int orig2[] = {1,5,15,23,3}; List list2(orig2, 5, 5);](https://s3.amazonaws.com/si.experts.images/answers/2024/09/66e1409074921_16066e140900665a.jpg)
\#include \#include "List. h" using namespace std; 10. void List::insert(ElementType item, int pos) \{ if (mySize == myCapacity) exit(1); if (pos mySize) return; I/ shift array elements right to make room for item for (int i= mySize; i> pos; i) myArrayPtr [i]= myArrayPtr [i1]; /I insert item at pos and increase list size myArrayPtr [pos] = item; mySize++; // don't forget this! \} void List: :erase(int pos) \{ if (pos = mySize) return; I/ shift array elements left for (int i= pos; i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
