Question
Write a program to average columns in a CSV file Write a C program to parse a *.csv file where fields are separated by the
Write a program to average columns in a CSV file
Write a C program to parse a *.csv file where fields are separated by the ';' character and print out the average of each column (which is an integer), separated by the ';' character.
Your executable file must be named avgcsv. It should take as argument the name of a csv file and outputs the average of each column, separated by ';'. You should print out the average to the precision of 2 decimal points.
For example, suppose the contents of the example.csv are as follows:
$ cat example.csv 10;25.5;56 22;10;100.4
Then, the expected output of the command ./avgcsv example.csv should be:
$ ./avgcsv example.csv 16.00;17.75;78.20
We expect you to write a Makefile to generate the avgcsv executable file from your source code. Recitation 1 teaches you how to write a Makefile.
We do not provide you with any tests and will test your program under a few csv files of our own choosing during grading time. We highly encourage you to write unit tests for your program.
Once finished, add relevant source files and Makefile to your git repo
Example of input files:
6;0;-5;-1;9;7;6;-5;6;-7 |
-9;0;-6;1;8;0;1;8;4;-4 |
-5;8;0;-9;-7;6;3;-8;-2;-8 |
9;7;1;8;-9;3;7;6;6;1 |
3;7;-4;9;-2;0;-4;0;0;-4 |
-8;6;2;-3;0;1;3;2;-6;-1 |
0;-2;9;-6;2;-4;-9;7;-6;-1 |
9;0;-4;7;-7;3;5;6;4;8 |
-3;-2;3;-9;1;9;4;6;-3;-6
**Note: the existing chegg answer does not work
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