#include <stdio.h> #include <stdlib.h> int main(int argc, char* argv[]) { if(argc < 3) { return 0; } int rowlength,collength,row2length,col2length; int row=0,col=0; int tab[rowlength][collength],tab1[row2length][col2length]; int tab2[rowlength][col2length]; ReaderValues(file,rowlength,collength,row2length,col2length, tab, tab1); Multiplication(rowlength,collength,row2length,col2length, tab, tab1,tab2,argv); Save(rowlength, col2length, tab2, argv); return 0; } void ReaderValues(FILE* file, int rowlength, int collength, int row2length, int col2length, int tab[rowlength][collength], int tab1[row2length][col2length]) { int row=0,col=0; while( fscanf( file, "%d,", &tab[row][col] ) != EOF ) //WCZYTYWANIE WARTOŚCI Z PLIKU TXT DO 2 TABLIC { col++; if(col==collength && row==rowlength-1) { row=0; col=0; { col++; if(col==col2length) { col=0; row++; } } } if(col==collength) { col=0; row++; } } } int Multiplication(int rowlength, int collength, int row2length, int col2length, int tab[rowlength][collength],int tab1[row2length][col2length],int tab2[rowlength][col2length]) // MNOŻENIE MACIERZY { int i,j,k; for(i=0; i<rowlength; i++) { for(j=0; j<col2length; j++) { tab2[i][j] = 0; for(k=0; k<row2length; k++) { tab2[i][j] += tab[i][k] * tab1[k][j]; } } } for(i=0; i<row2length; i++) { for(j=0; j<col2length; j++) { } } } void Save(int rowlength, int col2length, int tab2[rowlength][col2length], char* argv[]) // ZAPISYWANIE MACIERZY WYNIKOWEJ DO PLIKU { int i,j; FILE* file2; else { for(i=0; i<rowlength; i++) { for(j=0; j<col2length; j++) { } } } }
Title | Name | Language | UNIX | When |
---|---|---|---|---|
Re: Untitled | Colossal Tortoise | c | 1515960603 | 6 Years ago. |