#include #include #include const int maxsize=700; const int maxnum=10; void matrixFromFile(int** mat, int rows, int cols, char* filename) { FILE *infile; int i, j; if ((infile=fopen(filename, "r")) == NULL) { printf("Could not open file\n"); exit(0); } for(i=0; i starttimeSec) { totalSec = endtimeSec-starttimeSec; totalMicro = endtimeMicro + (1000000 - starttimeMicro); } else { totalSec = 0; totalMicro = endtimeMicro - starttimeMicro; } printf("Time = %d sec, %d microsec\n", totalSec, totalMicro); printf("Reading solution product...\n"); matrixFromFile(prod2, rows1, cols2, filename3); printf("Check matrix multiplication...\n"); if (checkMatrices(prod,prod2, rows1, cols2)) printf("Congratulations, you agree with my answer\n"); else printf("Sorry, we disagree\n"); for (i = 0; i < rows1; i++) { free(m[i]); } free(m); for (i = 0; i < rows2; i++) { free(n[i]); } free(n); for (i = 0; i < rows1; i++) { free(prod[i]); } free(prod); for (i = 0; i < rows1; i++) { free(prod2[i]); } free(prod2); return 0; }