Question: Create a C (NOT a C++)! program Create a C program as follows and PUT COMMENTS throughout code for clarification! 1. Ask the user for
Create a C (NOT a C++)! program
Create a C program as follows and PUT COMMENTS throughout code for clarification! 1. Ask the user for the name of a file, read the name of the file from standard input. The first row of the file contains the number of rows and columns in the file. The remainder of the file is expected to contain a matrix of numbers in the form of multiple lines of space or tab delimited numbers. Examples are provided below. For this project, no valid input file shall have more than 20 rows or 20 columns. 2. Read the contents of the file and determine if the matrix of numbers exhibits vertical additive symmetry. The definition of this term is provided below. 3. If the matrix of numbers in the file exhibits vertical additive symmetry, output vertical additive symmetry to standard output. Otherwise, output no vertical additive symmetry to standard output. 4. Print each row of the matrix in descending order, one row per line of output, with each number separated by a space. Your program should use defensive programming techniques. This means your program should check input provided by the user for errors and deal with unexpected values without crashing. If is okay to terminate the program programmatically on an error, but the C runtime should not output an error. Ensure your program is well documented, well structured, and uses meaningful variable names. Use multiple functions as necessary for good structure and readability. Sample Run #1
2 3 //(2 represents the number of rows and 3 represents the number of columns)
56 98 34.5
12 25 45 Definition of vertical additive symmetry: A matrix of numbers is defined to exhibit vertical additive symmetry if the sum of the numbers in the columns of the matrix exhibits vertical symmetry. For this input file, the sums of the columns are: 68 123 79.5 Because this list is not vertically symmetrical, this input file does not exhibit vertical additive symmetry. (Remember, in a list with an odd number of values, the middle column is considered symmetric with itself.) Here is the sample output of the program run with this input file: Enter the filename: notsymmetric2.txt
no vertical additive symmetry
98.000000 56.000000 34.500000
45.000000 25.000000 12.000000 Sample Run #2
3 4
1.4 1.6 7.8 7
4.6 6.65 1.45 -2
1 1 0 2 The columns of this matrix yield the following sums: 7 9.25 9.25 7 This list of sums exhibits vertical symmetry thus the matrix exhibits vertical additive symmetry. Here is the sample output of the program run with this input file: Enter the filename: symmetric2.txt
vertical additive symmetry
7.800000 7.000000 1.600000 1.400000
6.650000 4.600000 1.450000 -2.000000
2.000000 1.000000 1.000000 0.000000
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
