In this assignment, you will use pointers to implement our own vector class. It will have the following features:
Dynamically allocated array of integers.
Size variable that keeps track of the number of elements in the array. Starts at 0.
Capacity variable that keeps track of the amount of memory allocated for the array. Starts at capacity 1.
Each time the size reaches the capacity, double the capacity
Several of the features available from the STL vector (insert, erase, push back, etc)
You will submit 3 files:
MyVector.h
MyVector.cpp
main.cpp
Output of 3 pushbacks:
Choose from the following menu:
1) Push back
2) Insert
3) Erase
4) Print
5) Size
6) Capacity
7) Exit.
1
Enter the number to push back: 1
Choose from the following menu:
1) Push back
2) Insert
3) Erase
4) Print
5) Size
6) Capacity
7) Exit.
1
Enter the number to push back: 2
Choose from the following menu:
1) Push back
2) Insert
3) Erase
4) Print
5) Size
6) Capacity
7) Exit.
1
Enter the number to push back: 3
Choose from the following menu:
1) Push back
2) Insert
3) Erase
4) Print
5) Size
6) Capacity
7) Exit.
4
Contents:
1 2 3
Choose from the following menu:
1) Push back
2) Insert
3) Erase
4) Print
5) Size
6) Capacity
7) Exit.