Question
Fill in the missing C++ code in program Reverse. Put the following data in file reverse.dat. Run the program and show the results displayed on
Fill in the missing C++ code in program Reverse. Put the following data in file reverse.dat. Run the program and show the results displayed on the screen. 2 4 5 3 7 9 1 6 8 0
// Program Reverse reads numbers into an array
// and prints them out in reverse order.
#include
#include
usingnamespace std;
constint MAX = 10;
int main()
{
int numbers[MAX];
ifstream inData;
int value;
int index;
inData.open("reverse.dat");
for (index = 0; index < MAX; index++)
{
// FILL IN code to read value from file
// FILL IN code to store value into numbers
}
for (index = MAX - 1; index >= 0; index--)
// FILL IN code to write numbers on the screen
return 0;
}
Lastly, extend the program reverse to print the sum of the values stored in the array numbers.
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