Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In this Programming Exercise you will write a C + + program that does the following: Prompt the user to identify a file containing integer
In this Programming Exercise you will write a program that does the
following:
Prompt the user to identify a file containing integer values, one value in each
record.
Create a vector that can be used to store integer int values.
Read the values from the file and store them in the vector.
Close the file.
Display the number of elements in the vector as well as all the even values in
the vector.
Remove the elements in the vector that contain even values.
Display the number of elements that were deleted.
Display the number of elements in the vector as well as all the odd values in
the vector.
Calculate and display the total of all values remaining in the vector.
Sample Output:
Identify the file containing initial values: D:Datavinputtxt
even entries removed.
Size is odd values:
Total is
You must solve this problem using only the material that has been presented
so far in the course. At this point, we have covered Chapters through
Hint: Methods named erase and begin which are not
mentioned in our textbook, can be used to delete a specific
element from a vector. For example, to delete the third element
from a vector named numbers, you would use the following
statement:
numbers.erase numbersbegin ;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started