Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void elementy (int tab[][100], int m, int n)
- {
- for (int x=0; x<m; x++)
- {
- for (int y=0; y<n; y++)
- {
- cout << "Podaj wartosc tab[" << x+1 << "][" << y+1 << "]: ";
- cin >> tab[x][y];
- }
- }
- }
- void zerowanie(int tab[][100])
- {
- for (int x=0; x<100; x++)
- {
- for (int y=0; y<100; y++)
- {
- tab[x][y]=0;
- }
- }
- }
- void iloczyn(int tab1[][100], int tab2[][100], int tab3[][100], int a, int b, int c, int d)
- {
- for(int z=0; z>a; z++)
- {
- for(int y=0; y<d; y++)
- {
- for(int x=0; x<b; x++)
- {
- tab3[z][y]=tab3[z][y]+(tab1[z][x]*tab2[x][y]);
- }
- }
- }
- }
- void wyniki(int tab[][100], int a, int d)
- {
- for(int x=0; x<a; x++)
- {
- for(int y=0; y<d; y++)
- {
- cout << "tab[" << y+1 << "][" << x+1 << "]=" << tab[y][x] << endl;
- }
- }
- }
- int main()
- {
- int tab1[100][100], tab2[100][100], tab3[100][100], a, b, c, d;
- cout << "Podaj ilosc wierszy pierwszej macierzy: ";
- cin >> a;
- cout << "Podaj ilosc kolumn pierwszej macierzy: ";
- cin >> b;
- elementy(tab1, a, b);
- c=b;
- cout << "Podaj ilosc kolumn drugiej macierzy: ";
- cin >> d;
- elementy(tab2, c, d);
- zerowanie(tab3);
- iloczyn(tab1, tab2, tab3, a, b, c, d);
- wyniki(tab3, a, d);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement