共计 1744 个字符,预计需要花费 5 分钟才能阅读完成。
Time it Took Matthew
About 40 minutes but I forgot to time myself this time :(
What to submit
A zip file containing
- A Makefile that will compile your code into a an executable named
find_determinant.out - 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/al… Here you can find a
determinant calculator to help you check your work:
https://www.symbolab.com/solv…
Problem Details - The name of the file containing the matrix will be given on the command line
a. This name will always be valid - The structure of a matrix file is
Num_rows num_cols
row1_val1 row1_val2 row1_val3…
row2_val1 row2_val2 row2_val3…
… - The files will always be structured correctly
- Examples of these files have been included in the starter code
- The matrices will always be square, ie N X N
- The values in the matrix are real numbers
Additional Requirements - You should always print your answer to 2 decimal places
- 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 - Your solution should consist of at least 3 source files
a. matrix.c
b. matrix.h
c. main.c
Hints - This problem is recursive
- 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 - 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
- 2 3
- 5 6
- 8 9
./findDeterminant.out 3X3Matrix.txt
The determinant is 0.00.
WX:codehelp
正文完