Dynamic Memory

for this lab you will create two programs to read in files of different sizes into an array

copy over the files provided for you, you will be provided with main1.cpp


main1.cpp   
---------------------------
this program will read the entire target file two times
 first reads all the numbers from the file until the end 
as it reads in a value in keeps track of how many numbers were in the file
the first time it is read is simply to determine how may values are in the file 

this will be the capacity

it then creates a dynamic array of the size calculated when reading the file the first time

it then opens the file a second time and reads all the values into an array




main2.cpp
---------------------------
copy over your main1.cpp 

only read the file once, you will not know how big to make the array so we will start with a small one and make it larger if needed

you will need two int values to keep track of the capacity and current number of values

create a dynamic array with a capacity of 5



read a value from the file, store it into the array, increment the number of items

when the array is full create a second array of twice the previous capacity
copy the values from the current array to the new array
delete the old array

continue reading in values from the file

your program will re size as many times as needed



-------------------------

there are 2 runable examples

make your two runable programs match the output of the runable examples



there are 3 different test files with variable size for you to use while testing

test_input100.txt  test_input50.txt  test_input9.txt