Question: Change CArray as follows Replace the fixed size array with a dynamic array Add a constructor that passes the size of the array as a
Change CArray as follows
Replace the fixed size array with a dynamic array
Add a constructor that passes the size of the array as a parameter
Add a function that copies a dynamic array into this array.
Add a copy constructor to CArray
Add a function that displays the array to a arbitrary stream
Derive CSortedArray from CArray
Add functions that enter elements into the array in sorted order
Override any base class functions that insert elements out of order.
*Note: I need help to write out this problem in C++ while using Visual Studio 2017 and need a main.cpp
//CArray.h
#pragma once template
//predicates bool isFull(); bool isEmpty();
//accessors int getPopulation(); int getCapacity();
//custom methods void fill(const Type& value); int find(const Type& value); bool insertAt(const Type& new_item, int new_position); void show(); private: int population; int capacity; Type elts[16]; }; template
//move the elements from new position to population - 1 down one position for (int i = population - 1; i >= new_position; --i) elts[i + 1] = elts[i]; elts[new_position] = new_elt; population++; return true; } template
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
