Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C program in terminal/linux machine: Assume each line of a csv file has three items: name,age,GPA. You can assume the name is at most 50

C program in terminal/linux machine: Assume each line of a csv file has three items: name,age,GPA. You can assume the name is at most 50 characters, the age is a whole number with at most 3 digits, and the GPA has at most 2 digits after the decimal point (for example, 3.17). Also, you can assume that there are no more than 100 lines in the csv file. Your program must: Take a csv filename as a command line argument. Open the csv file and use fgets to read the contents. Store the data in an array of structures. Write the data out to a new csv file called output.csv, with the following changes: In each line, switch the positions of the age and GPA data. Reverse the order of the lines. Add a line at the end with the average GPA and average age in the 2nd and 3rd fields. Other than the changes above, the data in the output file should be identical to the data in the input file (exact same characters with no change in formatting or numerical approximations).

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

Microsoft Visual Basic 2008 Comprehensive Concepts And Techniques

Authors: Gary B. Shelly, Corinne Hoisington

1st Edition

1423927168, 978-1423927167

More Books

Students also viewed these Databases questions