Question: Write a C program that asks the user for an input text file (.txt) name with full directory. The .txt file will be formatted as

Write a C program that asks the user for an input text file (.txt) name with full directory. The .txt file will be formatted as it is in the example below. Each number will be shown on a different line. Display error message if the file cannot be opened. If file is opened, set all numbers of the file to an array. Program should determine number of values in the array/list. Next, the program should find the max, min, mean, median, and standard deviation of the set of data and display them to the terminal screen. The following functions must be used in the program:

Max

Largest value of number in the array/list.

Inputs: list of numbers (array) & length of list

Output: Maximum value

Min

Smallest value of number in the array/list

Inputs: list of numbers (array) & length of list

Output: Minimum value

Mean

Average of the data set

Inputs: list of numbers (array) & length of list

Output: Average

Median

Number in the middle of the set of data.

Inputs: SORTED list of numbers (array) & length of list

Output: Median

StdDevP

Standard deviation defined by the formula shown below, where n is the number of values in the array.

Inputs: list of numbers (array) & length of list

Output: Standard Deviation

GetInput

Retrieves the text file, sets values to an array, counts number of values in array.

Outputs: List of numbers & length of list

DisplayStats

Displays statistics to terminal screen

Inputs: Max, Min, Mean, Median, and standard deviation.

Sum

Determines sum to be used in standard deviation and mean function

Inputs: list of numbers & length of list

Output: Sum

Sort

Sort list from lowest to highest to be used in median function

Inputs: list of numbers & length of list

Output: array as sorted list

Standard Deviation: Write a C program that asks the user for an input text

Example .txt file

35

54

65

92

79

68

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!