Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

6. Here are 2 files: numbers1.txt , numbers2.txt . The they contain a header line telling you how many data items follow, and a series

6. Here are 2 files: numbers1.txt , numbers2.txt . The they contain a "header" line telling you how many data items follow, and a series of data values. (The first one is very small, so you can easily verify you are getting the right results; the second is larger, too large to verify by hand.) a. Write a program that can calculate the average, min and max of the numbers in the first 2 files. It should read the first value (# of points), allocate an array the correct size, read the data into that array, then analyze the array and print the count, average, min & max of the array. a. Use a function to read the data, a second function to find the average, and a third function to find the min & max. Read the count and allocate the array itself in the read_data(...) routine -- your read_data(...) routine will have to pass back both the count and the pointer after it allocates the array. b. I recommend that you print out the first few elements and the last few elements of the data file when you read them in to make sure you get all the values. Some print statements in the various routines would also be helpful while writing/testing to make sure things are working properly. c. Make sure you delete the dynamic array properly and set your pointer back to NULL. b. Modify your program to work with an array of filenames, and read and print the statistics for each file in the list. You can use an array of strings for the filenames: string filenames[] = {"numbers1.txt", "numbers2.txt"}; To do that, simply add an outer loop that calculates the statistics on each file, then moves on to the next file.: (part b) and read_nums_nh.cpp (part c)

5 0.6584 0.4907 0.8009 0.9209 0.1227 
100 0.6586 0.3846 0.4242 0.0112 0.8436 0.5168 0.1788 0.8928 0.1873 0.1028 0.3814 0.2861 0.4140 0.8359 0.4081 0.0883 0.2221 0.1202 0.6439 0.9184 0.7060 0.0387 0.0478 0.4748 0.5952 0.0356 0.0935 0.3628 0.1593 0.1353 0.6460 0.9259 0.7315 0.0014 0.8023 0.4504 0.1959 0.4978 0.8705 0.0927 0.2421 0.2144 0.9471 0.7074 0.4388 0.9107 0.8313 0.3972 0.3291 0.9885 0.4689 0.7887 0.6331 0.9285 0.0664 0.2858 0.8726 0.6144 0.7742 0.4244 0.1807 0.3594 0.7822 0.0160 0.3048 0.1838 0.9963 0.6201 0.3480 0.6696 0.5898 0.0534 0.2794 0.0626 0.7458 0.9797 0.6402 0.2789 0.7918 0.4829 0.8573 0.3744 0.8515 0.6129 0.7993 0.1410 0.6169 0.4777 0.2654 0.3925 0.1797 0.9534 0.3515 0.1373 0.2590 0.5262 0.8967 0.5786 0.5796 0.9753 

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

Database Driven Web Sites

Authors: Joline Morrison, Mike Morrison

2nd Edition

ISBN: ? 061906448X, 978-0619064488

More Books

Students also viewed these Databases questions

Question

How many Tables Will Base HCMSs typically have? Why?

Answered: 1 week ago

Question

What is the process of normalization?

Answered: 1 week ago