All pastes #556255 Raw Edit

macierz

public cpp v1 · immutable
·published 2007-06-10 14:18 UTC
rendered paste body
#include <iostream>#include <conio.h>#include <time.h>#include <stdlib.h>void FormatMsg(int c[3][3]);using namespace std;int main(){    int a[3][3];    int b[3][3];    int c[3][3];    int l=3;    srand ( time(NULL) );    int val = rand() % l;    int tmp = 0;     for (int h = 0; h < 3; h++)    {        for (int z = 0; z < 3; z++)        {            val = rand() % l;            a[h][z] = val;            val = rand() % l;            b[h][z] = val;            //a[h][z]=2;            //b[h][z]=1;        }    }        for (int h = 0; h < 3; h++)    {        for (int z = 0; z < 3; z++)        {            //wiersze            tmp = 0;            int y = 0;            for (; y < 3; y++)            {                //kolumny                tmp += a[h][y] * b[y][z];                            }            c[h][z] = tmp;            cout<<endl;        }    }    cout<<"A:"<<endl;    FormatMsg(a);    cout<<endl;    cout<<"B:"<<endl;    FormatMsg(b);    cout<<endl;    cout<<"Wynik:"<<endl;    FormatMsg(c);    getch();}void FormatMsg(int c[3][3]){    for (int z = 0; z < 3; z++)    {        printf("%6d%6d%6d", c[z][0],c[z][1],c[z][2]);        cout<<endl;    }}