Time it Took Matthew
About 40 minutes but I forgot to time myself this time :(
What to submit
A zip file containing
1. A Makefile that will compile your code into a an executable named
find_determinant.out
2. All of your source files for your answer (.c and .h files)
Make sure to not accidentally zip the folder that contains your answer but instead the files
themselves.
Zip This
Don’t Zip This
Problem Description
Write a program to find the determinant of a matrix. For how to find a determinant of a matrix
please see: https://www.mathsisfun.com/algebra/matrix-determinant.html. Here you can find a
determinant calculator to help you check your work:
https://www.symbolab.com/solver/matrix-determinant-calculator
Problem Details
1. The name of the file containing the matrix will be given on the command line
a. This name will always be valid
2. The structure of a matrix file is
Num_rows num_cols
row1_val1 row1_val2 row1_val3…
row2_val1 row2_val2 row2_val3…
...
3. The files will always be structured correctly
4. Examples of these files have been included in the starter code
5. The matrices will always be square, ie N X N
6. The values in the matrix are real numbers
Additional Requirements
1. You should always print your answer to 2 decimal places
2. You must use a struct to represent your matrix object
a. If you do not use a struct the TAs will manually deduct 50% from your score after
the due date has passed
3. Your solution should consist of at least 3 source files
a. matrix.c
b. matrix.h
c. main.c
Hints
1. This problem is recursive
2. Make sure to only open the file in read (“r”) mode. If you open it in read and write (“r+”)
mode or write (“w”) mode you will get an error as you only have read permissions for the
matrix files
3. You are free to write as many functions as you want, so take advantage of that fact and
break the problem down into lots of steps
Example
In the following example, input has been underlined to help you tell it apart from what you
should output. You don’t need to underline anything, it is just a visual aid for you.
Assume the file 3X3Matrix.txt had the following contents
3 3
1 2 3
4 5 6
7 8 9
./findDeterminant.out 3X3Matrix.txt
The determinant is 0.00.