We're supposed to Write a program that reads an unknown number of integers from a data file called “data.txt” into a vector of integers named V. V is initially empty and grows as the user reads data from file.
Once done copying data into vector V, you need to print the contents of V (write a function print that prints the contents of a vector of any size) and perform some other tasks on the vector as described below.
This is the data file: 5 6 12 87 100 28 35 66 77 29
EVERY TIME I RUN THIS CODE IT OUTPUTS: 5 12 100 35 77
You're reading twice but outputting once, which explains why the output skips every other number. Simply remove the line in question and it will work as expected.