I've been given an assignment to calculate the determinant of a 3x3 matrix which I must read from a .dat file. The contents of the .dat file should look something like this:
1 3 2
2 3 3
1 2 2
Basically, I can't work out how to read these values from the .dat file and print them in my program. If anyone can offer any help I'll be very grateful, thanks in advance
EDIT: what I have so far.
Code:
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char* argv[])
{
FILE *input;
float v1[3], v2[3], v3[3];
const char inp_fn[]="matrix.dat";
input = fopen(inp_fn, "r");