Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Design and write a C++ program to read in a file of integers and process the list. The input file should be named data.txt. The

Design and write a C++ program to read in a file of integers and process the list. The input file should be named "data.txt". The first line of the file is how many integers are contained in the rest of the file. The remainder of the file will have one integer per line. You must use the new operator to dynamically allocate storage for the list of numbers. You must also use the delete operator to deallocate the storage when you are done with the list.

Once the numbers have been read into memory from the file, your program will manipulate the list with three functions that all take a pointer parameter. The functions perform the following operations:

  • Find the mean of the list - returns a floating point number
  • Determine if a specific number is the list - returns a boolean
  • Count how many numbers in the list are even - returns an integer

All three of the required functions require one parameter, the pointer to the list. You may need additional parameters to your functions.

The output of your program will be:

  • the number of integers in the list,
  • the mean of the list,
  • the existence of a specific number (prompt the user for a number to find), and
  • the number of even numbers in the list.

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

Seven Databases In Seven Weeks A Guide To Modern Databases And The NoSQL Movement

Authors: Eric Redmond ,Jim Wilson

1st Edition

1934356921, 978-1934356920

More Books

Students also viewed these Databases questions

Question

Identify three ways to manage an intergenerational workforce.

Answered: 1 week ago

Question

Prepare a Porters Five Forces analysis.

Answered: 1 week ago

Question

Analyze the impact of mergers and acquisitions on employees.

Answered: 1 week ago