Question
Write a complete C++ program that will do the following: a) Read integers, one per line, from a file called integers.dat. The integers in the
Write a complete C++ program that will do the following: a) Read integers, one per line, from a file called integers.dat. The integers in the file can be positive, negative, or 0. There are at most 125 positive integers (may be less) in the file. Store the positive integers only in an array. b) Output the positive integers to a file called positiveIntegers.dat in reverse sequence (the first integer in the array should be the last one written to the file). c) Write a function that has the array as one of the parameters and returns the average of the positive integers. d) Display on the output screen, with appropriate labels, the number of positive integers and the average of the positive integers.
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