Matrix A's values
Matrix B's values
For example, in tester.txt I may have:
2
1.0 2.0
2.0 0.0
0.9 1.1
2.3 -1.5
This creates two 2x2 matrices with the values above. How do I get these values so I can build the matrix and perform addition or multiplication, etc. I think I have to use malloc, but i'm not too familiar with this.
What I have right now is:
#include <stdio.h>
int main (void) {
char filename[] = "";
printf("Please enter the input file: ");
scanf("%s", &filename);
FILE *file = fopen(filename, "r");
if (file != NULL) {
char line [128];
while (fgets(line, sizeof line, file) != NULL) {
fputs(line, stdout);
}
fclose(file);
}
else
{
perror(filename);
}
return 0;
}

New Topic/Question
Reply




MultiQuote







|