Pointer Array Functions
- The following functions will be used in several projects in this term.
- Writ these functions and test them well.
- Please read the Pointer Projects Guidelines before you begin.
- Do not use array notation. You will only use brackets when you declare an array
const int MINIMUM_CAPACITY = 3;
template<class T>
T* allocate(int capacity= MINIMUM_CAPACITY); //allocate 'capacity'
// elements.
// return array
template<class T>
T* reallocate(T* a, int size, int capacity); //take array, resize it
// return new array.
// delete old array
template<class T>
void print_array(T* a, int size,
int capacity = 0, ostream& outs = cout); //prints
// (size/capacity)
// for debugging
template <class T>
void print(T* a, unsigned int how_many,
ostream& outs = cout); //print array
template<class T>
T* search_entry(T* a, int size, const T& find_me); //search for 'find me'
template <class T>
int search(T* a, int size, const T& find_me); //search for 'find_me'
template <class T>
void shift_left(T* a, int& size, int shift_here); //shift left @ pos:
// erases @ pos
template <class T>
void shift_left(T* a, int& size, T* shift_here); //shift left @ pos:
// erases @ pos
template <class T>
void shift_right(T *a, int &size, int shift_here); //shift right:
// make a hole
template <class T>
void shift_right(T *a, int &size, T* shift_here); //shift right:
// make a hole
template<class T>
void copy_array(T *dest, const T* src,
int many_to_copy); //copy from src to dest
template <class T>
T* copy_array(const T *src, int size); //return a
// copy of src
template <class T>
string array_string(const T *a, int size); //return array
// as a string