Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Number Analysis Program Write a program that asks the user for a file name. Assume the file contains a series of integer numbers, each written

Number Analysis Program
Write a program that asks the user for a file name. Assume the file contains a series of integer numbers, each written on a separate line (maximum 20). The program should read the contents of the file into an array and then display the following data:
The lowest number in the array
The highest number in the area
The total of the numbers in the array
The average of the numbers in the array
TEMPLATE:
//DO NOT MODIFY THIS SECTION
#include
#include
using namespace std;
//prototypes (INSERT HERE IF YOU USE FUNCTIONS)
//end prototypes
int main()
{
ifstream ifile;
string fileName;
int lowest, highest, total=0, counter=0, numbers[20];
double average;
cout << "Name of file: ";
cin >> fileName;
ifile.open( fileName );
if( ifile.fail())
{
cout << "Error" << endl;
return 1;
}
//ADD YOUR CODE FROM HERE

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

C++ Database Development

Authors: Al Stevens

1st Edition

1558283579, 978-1558283572

Students also viewed these Databases questions

Question

What is a promissory note?

Answered: 1 week ago