Question: Find modes of data from file . Write a program which will read from the file numbers.txt. The file will contain zero or more data

Find modes of data from file . Write a program which will read from the file numbers.txt. The file will contain zero or more data sets (each line of the file contains exactly one value). A data set is defined by an integer indicating the number of values in the data set. Following the dataset will either be a 0 (zero) indicating no more data sets or a value containing the number of values in the next set. A dataset consists of at most 100 value. After a dataset is read, the program should then print out the original values and the values of the dataset sorted in ascending order SIDE BY SIDE, with the columns properly labeled (see sample run). Lastly, the mode (or count) of each value should be output. See the sample run below for examples. i have some done i need help finishing

#define _CRT_SECURE_NO_WARNINGS

#define NULL

#include

#include

void main()

{

int a, b; //for values to add

int result; // the sume

FILE *f; //input file handle

FILE *g; // output file handle

f = fopen(" numbers.txt", "rt"); // opens file and is information, r = read, t = text translate

if (f == NULL) // f is NULL or Zero is error occurs

{

printf("?Error-file numbers.txt not found-exit program")

exit(1);

}

fscanf(f, "%d", &a); // read first in file

fscanf(f, "%d", &b);

sum = a + b; // add the two values together

g = fopen("sum.txt", "wt");

if (g == NULL)

{

printf("?Error-unable to open sum.txt")

exit(0);

}

fprintf(g, "The result is %d ", result);

fclose(f);

fclose(g);

printf("The program is now done");  Find modes of data from file . Write a program which

T-Mobile 11:27 AM ece160.org n first dataset + number of values in next dataset number of values in next dataset + no more datasets output shoula b riginal Berted Driginal Berted 25 25-4 riginal Serted

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!