Write a C program called as2.c (all lower case) to filter out the
garbage in the
multiple choice answer file from computer center. (There are 19 questions.
The answers are in the same format starting from column 30. Skip the 1st
line.)
Your output should be the same as the result file.
Note:
§ You must use the name as2.c for your file and use either 1-dimensional or 2-dimentional array in order to get any credit
§ You must assume unknown number of students (i.e. unknown number of rows of data). And there are 19 columns of useful data. However, there are garbage before and after those 19 columns.
§ You must use functions. Each function performs only one task (For example: getInput function only gets input from keyboard). Only function calls in main function. You must use arguments in functions. No global variables are allowed.
§ Use meaningful names for variables, indent and line up code for each control structure and in each block
§ Put your name, purpose, assumption, input, output and algorithm in the program
(You can
1. copy the data file to your current folder by
cp /home/cshing/public_html/310/Assignment/as2_data.txt .
2. compile and link by
gcc –o as2 as2.c
or
gcc as2.c
3. execute by
as2 < as2_data.txt > as2_out.txt
or
a.out < as2_data.txt > as2_out.txt
Submit your as2.c file.