Answered step by step
Verified Expert Solution
Question
1 Approved Answer
(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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started