Computer

Computer
Objective:

Become familiar with the use of Pointers in C++
Develop familiarity of using functions to process Pointers

Description:
Develop the object intArray that creates and manages an array of integers by the use of pointers. The intArray object will implement a number of useful manipulation of arrays including insert, delete, add, equal, and etc. These functions will limit the use of an array to proper handling. For example these functions will eliminate the possibility of overstepping the boundaries of an array.

Specific Requirements:

Your object should satisfy the following criteria:

Should be named intArray
Should contain a default constructor that will set the data pointer to null and size to 0.
Should contain the alternate constructor intArray(int arraySize, int initValue) that will accept initial size and value for the array. If the initial value is missing, a default value of 0.
Should contain the alternate constructor intArray(int anArray[], int arraySize) that will accept an array and create an object equal to the array.
Should contain a copy constructor.
The parameter that holds the size of the array should be private.
Should contain a size() method that will return the size of the array.
Should contain a set(index, value) method that will set the data[index] = value.
Should contain a get(index) method that will return data[index].
Both set and get methods should exit the program if index is outside of the array boundaries.
Should contain an overloaded assignment operator (=) similar to your previous copy(intArray anIntArray) method that will copy one anIntArray into another. Furthermore the operator= should be capable of cascaded operation.
Should contain an overloaded equality operator (==) similar to the equal(intArray anIntArray) method that will return true if two arrays are equal in size and content.
Should contain an overloaded addition and subtraction operator (+, -) similar to your previous add(intArray anIntArray) and subtract(intArray anIntArray) methods that will add or subtract one intArry into/from another. Both operations should be capable of cascaded operation.
Should contain overloaded post and pre-increment operators. No cascading necessary.
Should contain overloaded unary – operator. No cascading necessary.
Should contain overloaded I/O-insertion ( << ) and I/O-extraction ( >> ) operators. Examples: cout << intArray should result in printing of the array to the stdout. cin >> intArray should prompt the user to entry values for every element of the array.
The copy, add and subtract methods above should exit the program if size incompatibility is identified.
Should contain an insert(index, value) method that will insert the value at the index place of an array. The value should be inserted and not replaced.
Should contain a remove(index) method that will delete the index item of the array. Your method should then return the remove value.
Both insert and remove should exit the program if the index is invalid, and should expand/shrink the array appropriately.
Your program should have no memory leaks!

READ ALSO :   UNIT II ESSAY