Question: (LINUX) Assume the following text file foo.txt in your computer. The first line of the text file includes the field names of the following records.

(LINUX) Assume the following text file foo.txt in your computer. The first line of the text file includes the field names of the following records. # name:id:weight:height:gender Alice A:123:1.506E+2:5.00:F Bob B:456:1.807E+2:5.50:M Charlie C:789:0.892E+2:5.34:M Make a C program to read data from the text file and then output the average weight and the average height to screen. Copy and paste your code in your report. The output data should be formated as below. You should NOT use spaces to align the data in output. Spaces in output are only for separating words. The average weight : 130.52 lb The average height : 5.35 ft a) You should NOT assume you know how many records in the text file. b) You do NOT need to worry about if a field is mis-formated in the text file. c) Use ONLY fscanf and fprintf functions to read and output data. d) Do not use "cout<<...<                        

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!