/*
C/C++の宿題片付けます 161代目
http://t...content-available-to-author-only...h.net/test/read.cgi/tech/1354070278/
125 名前:デフォルトの名無しさん [sage]: 2012/12/06(木) 10:12:21.78
[1] 授業単元:c言語 関数&配列
[2] 問題文 関数配列の問題です。
http://www.dotup.org/uploda/www.dotup.org3703015.pdf
[3] 環境
[3.1] OS: Linux
[3.2] コンパイラ名とバージョン: gcc
[3.3] 言語: C
[4] 期限:12/11
ポインターは使わずによろしくお願いいたします
4.
*/
#include<stdio.h>
#define N (3) // 行, 列
void disp_matrix(double m[N][N])
{
int g, r;
for (g = 0; g < N; g++) {
for (r = 0; r < N; r++) {
}
}
}
void multmat(double mA[N][N], double mB[N][N], double mC[N][N])
{
int g, r, i;
for (g = 0; g < N; g++) {
for (r = 0; r < N; r++) {
mC[g][r] = 0.0;
for (i = 0; i < N; i++) {
mC[g][r] += mA[g][i] * mB[i][r];
}
}
}
}
int main()
{
double matrix_A[N][N] = { {1.0, 0.0, 2.0}, {2.0, 1.0, 2.0}, {3.0, 2.0, 1.0} };
double matrix_B[N][N] = { {1.0, 3.0, 2.0}, {2.0, 0.0, 1.0}, {1.0, 1.0, 1.0} };
double matrix_C[N][N];
printf("A =\n");disp_matrix
(matrix_A
); printf("B =\n");disp_matrix
(matrix_B
); multmat(matrix_A, matrix_B, matrix_C);
disp_matrix(matrix_C);
return 0;
}
LyoKICAgIEMvQysr44Gu5a6/6aGM54mH5LuY44GR44G+44GZIDE2MeS7o+ebrgogICAgaHR0cDovL3QuLi5jb250ZW50LWF2YWlsYWJsZS10by1hdXRob3Itb25seS4uLmgubmV0L3Rlc3QvcmVhZC5jZ2kvdGVjaC8xMzU0MDcwMjc4LwogICAgICAgIDEyNSDlkI3liY3vvJrjg4fjg5Xjgqnjg6vjg4jjga7lkI3nhKHjgZfjgZXjgpMgW3NhZ2Vd77yaIDIwMTIvMTIvMDYo5pyoKSAxMDoxMjoyMS43OCAgCiAgICAgICAgWzFdIOaOiOalreWNmOWFg++8mmPoqIDoqp4g6Zai5pWw77yG6YWN5YiXCiAgICAgICAgWzJdIOWVj+mhjOaWh+OAgOmWouaVsOmFjeWIl+OBruWVj+mhjOOBp+OBmeOAggogICAgICAgIO+9iO+9lO+9lO+9kO+8mi8vd3d3LmRvdHVwLm9yZy91cGxvZGEvd3d3LmRvdHVwLm9yZzM3MDMwMTUucGRmCiAgICAgICAgWzNdIOeSsOWigyAKICAgICAgICDjgIBbMy4xXSBPU++8miBMaW51eCAKICAgICAgICDjgIBbMy4yXSDjgrPjg7Pjg5HjgqTjg6nlkI3jgajjg5Djg7zjgrjjg6fjg7PvvJogZ2NjIAogICAgICAgIOOAgFszLjNdIOiogOiqnu+8miBDIAogICAgICAgIFs0XSDmnJ/pmZA6MTIvMTEgCiAgICAgICAg44Od44Kk44Oz44K/44O844Gv5L2/44KP44Ga44Gr44KI44KN44GX44GP44GK6aGY44GE44GE44Gf44GX44G+44GZIAogICAgNC4KKi8KI2luY2x1ZGU8c3RkaW8uaD4KCiNkZWZpbmUgTiAoMykgICAgICAgICAgICAgICAgICAgLy8g6KGMLCDliJcKCnZvaWQgZGlzcF9tYXRyaXgoZG91YmxlIG1bTl1bTl0pCnsKICAgIGludCBnLCByOwogICAgZm9yIChnID0gMDsgZyA8IE47IGcrKykgewogICAgICAgIHByaW50ZigifCAiKTsKICAgICAgICBmb3IgKHIgPSAwOyByIDwgTjsgcisrKSB7CiAgICAgICAgICAgIHByaW50ZigiJWYgIiwgbVtnXVtyXSk7CiAgICAgICAgfQogICAgICAgIHByaW50ZigifFxuIik7CiAgICB9Cn0KCnZvaWQgbXVsdG1hdChkb3VibGUgbUFbTl1bTl0sIGRvdWJsZSBtQltOXVtOXSwgZG91YmxlIG1DW05dW05dKQp7CiAgICBpbnQgZywgciwgaTsKICAgIGZvciAoZyA9IDA7IGcgPCBOOyBnKyspIHsKICAgICAgICBmb3IgKHIgPSAwOyByIDwgTjsgcisrKSB7CiAgICAgICAgICAgIG1DW2ddW3JdID0gMC4wOwogICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgTjsgaSsrKSB7CiAgICAgICAgICAgICAgICBtQ1tnXVtyXSArPSBtQVtnXVtpXSAqIG1CW2ldW3JdOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgfQp9CgppbnQgbWFpbigpCnsKICAgIGRvdWJsZSBtYXRyaXhfQVtOXVtOXSA9IHsgezEuMCwgMC4wLCAyLjB9LCB7Mi4wLCAxLjAsIDIuMH0sIHszLjAsIDIuMCwgMS4wfSB9OwogICAgZG91YmxlIG1hdHJpeF9CW05dW05dID0geyB7MS4wLCAzLjAsIDIuMH0sIHsyLjAsIDAuMCwgMS4wfSwgezEuMCwgMS4wLCAxLjB9IH07CiAgICBkb3VibGUgbWF0cml4X0NbTl1bTl07CgogICAgcHJpbnRmKCJBID1cbiIpO2Rpc3BfbWF0cml4KG1hdHJpeF9BKTsKICAgIHByaW50ZigiQiA9XG4iKTtkaXNwX21hdHJpeChtYXRyaXhfQik7CiAgICBwcmludGYoIkMgPSBBICogQiA9XG4iKTsKICAgIG11bHRtYXQobWF0cml4X0EsIG1hdHJpeF9CLCBtYXRyaXhfQyk7CiAgICBkaXNwX21hdHJpeChtYXRyaXhfQyk7CgogICAgcmV0dXJuIDA7Cn0=