/*
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
ポインターは使わずによろしくお願いいたします
3.
*/
#include<stdio.h>
#define MtM (2) // 行
#define MtN (3) // 列
void disp_matrix(double m[MtM][MtN])
{
int g, r;
for (g = 0; g < MtM; g++) {
for (r = 0; r < MtN; r++) {
}
}
}
void addmat(double mA[MtM][MtN], double mB[MtM][MtN], double mC[MtM][MtN])
{
int g, r;
for (g = 0; g < MtM; g++) {
for (r = 0; r < MtN; r++) {
mC[g][r] = mA[g][r] + mB[g][r];
}
}
}
int main()
{
double matrix_A[MtM][MtN] = { {1.0, 2.0, 3.0}, {3.0, 4.0, 5.0} };
double matrix_B[MtM][MtN] = { {5.0, 4.0, 3.0}, {2.0, 1.0, 0.0} };
double matrix_C[MtM][MtN];
printf("A =\n");disp_matrix
(matrix_A
); printf("B =\n");disp_matrix
(matrix_B
);
addmat(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+44GZIAogICAgMy4KKi8KI2luY2x1ZGU8c3RkaW8uaD4KCiNkZWZpbmUgTXRNICgyKSAgICAgICAgICAgICAgICAgLy8g6KGMCiNkZWZpbmUgTXROICgzKSAgICAgICAgICAgICAgICAgLy8g5YiXCgp2b2lkIGRpc3BfbWF0cml4KGRvdWJsZSBtW010TV1bTXROXSkKewogICAgaW50IGcsIHI7CiAgICBmb3IgKGcgPSAwOyBnIDwgTXRNOyBnKyspIHsKICAgICAgICBwcmludGYoInwgIik7CiAgICAgICAgZm9yIChyID0gMDsgciA8IE10TjsgcisrKSB7CiAgICAgICAgICAgIHByaW50ZigiJWYgIiwgbVtnXVtyXSk7CiAgICAgICAgfQogICAgICAgIHByaW50ZigifFxuIik7CiAgICB9Cn0KCnZvaWQgYWRkbWF0KGRvdWJsZSBtQVtNdE1dW010Tl0sIGRvdWJsZSBtQltNdE1dW010Tl0sIGRvdWJsZSBtQ1tNdE1dW010Tl0pCnsKICAgIGludCBnLCByOwogICAgZm9yIChnID0gMDsgZyA8IE10TTsgZysrKSB7CiAgICAgICAgZm9yIChyID0gMDsgciA8IE10TjsgcisrKSB7CiAgICAgICAgICAgIG1DW2ddW3JdID0gbUFbZ11bcl0gKyBtQltnXVtyXTsKICAgICAgICB9CiAgICB9Cn0KCmludCBtYWluKCkKewogICAgZG91YmxlIG1hdHJpeF9BW010TV1bTXROXSA9IHsgezEuMCwgMi4wLCAzLjB9LCB7My4wLCA0LjAsIDUuMH0gfTsKICAgIGRvdWJsZSBtYXRyaXhfQltNdE1dW010Tl0gPSB7IHs1LjAsIDQuMCwgMy4wfSwgezIuMCwgMS4wLCAwLjB9IH07CiAgICBkb3VibGUgbWF0cml4X0NbTXRNXVtNdE5dOwoKICAgIHByaW50ZigiQSA9XG4iKTtkaXNwX21hdHJpeChtYXRyaXhfQSk7CiAgICBwcmludGYoIkIgPVxuIik7ZGlzcF9tYXRyaXgobWF0cml4X0IpOwoKICAgIHByaW50ZigiQyA9IEEgKyBCID1cbiIpOwogICAgYWRkbWF0KG1hdHJpeF9BLCBtYXRyaXhfQiwgbWF0cml4X0MpOwogICAgZGlzcF9tYXRyaXgobWF0cml4X0MpOwoKICAgIHJldHVybiAwOwp9