Implement and thoroughly test a class named IVector that represents a 
dynamic array of integers.  It will have 3 private data members: int 
capacity, int count, and int * items.  The 'capacity' is the physical 
size of the dynamic array (its actual number of elements).  The 'count' 
is the number of elements currently in use (indices 0, 1, ..., 
count-1).  The pointer 'items' points to the first element of the 
dynamic array, which will be created by the operator 'new'.
Class IVector will have three constructors: 1) a default constructor 
that creates an array of capacity = 2 and count = 0; 2) a constructor 
with parameter int cap that creates an array of capacity = cap and 
count = 0; and 3) a copy constructor with parameter "const IVector %26amp; V" 
that creates an array that is identical to IVector V.
Class IVector will have the following public member functions: 1) two 
getters that return the capacity and the count of an IVector object;  
2) one declared "void Append( int item )" that adds 'item' to 'items' 
at position 'count' and increments 'count' by one; 3) one declared 
"void Insert( int index, int item ) "that adds 'item' to 'items' at 
position 'index' and increments 'count' by one; and one declared "void 
Delete( int index )" that deletes the item at position 'index' and 
decrements 'count' by one.
Overload the operator '[ ]' to access elements of the vector by 
subscript.
Need Help in making this c++ program?
Does not look easy. May be you can contact a C++ expert at websites like http://askexpert.info/
Reply:Sounds pretty straightforward to me.  So do you always get your homework done this way?  Explains a lot about the state of the Software Industry.....
Reply:What is the question?
surveys
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment