herrDeng網內搜尋

自訂搜尋

Ads

2017年10月18日 星期三

Ex4 C++ 2x2的矩陣乘法






如何使用VC



C++簡易矩陣乘法Matrix Multiplication(陣列、迴圈、函數練習

45 則留言:

B10533011 江道逸 提到...

#include <iostream>
#include <cstdlib>

void matrixMul(int C[2][2], int A[2][2],int B[2][2])
{
for (int i = 0; i < 2; i++)
for (int j = 0; j < 2; j++) {
C[i][j] = 0;
for (int k = 0; k < 2; k++)
C[i][j] += A[i][k] * B[k][j];
}
}
int main()
{
int A[2][2] = { {1,2},{3,4} };
int B[2][2] = { { 1,1 },{ 2,2 } };
int C[2][2] ;
matrixMul(C, A, B);
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++)
std::cout << C[i][j] << "\t";
std::cout << "\n";
}


system("Pause");
return 0;

}

B10533011 江道逸 提到...

#include
#include

void matrixMul(int C[2][2], int A[2][2],int B[2][2])
{
for (int i = 0; i < 2; i++)
for (int j = 0; j < 2; j++) {
C[i][j] = 0;
for (int k = 0; k < 2; k++)
C[i][j] += A[i][k] * B[k][j];
}
}
int main()
{
int A[2][2] = { {1,2},{3,4} };
int B[2][2] = { { 1,1 },{ 2,2 } };
int C[2][2] ;
matrixMul(C, A, B);
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++)
std::cout << C[i][j] << "\t";
std::cout << "\n";
}


system("Pause");
return 0;

}

B10533015 陳建志 提到...

#include <iostream>
#include <cstdlib>
void matrixMul(int C[2][2], int A[2][2], int B[2][2])
{
for (int i = 0; i<2; i++)
for (int j = 0; j < 2; j++) {
C[i][ j ] = 0;
for (int k = 0; k < 2;k++)
C[i][j] += A[i][k] * B[k][j];
}
}
int main()
{
int A[2][2] = { { 1,2 },{ 3,4 } };
int B[2][2] = { { 1,1 },{ 2,2 } };
int C[2][2];
matrixMul(C, A, B);
for (int i = 0; i < 2; i++) {
for(int j=0;j<2;j++)
std::cout << C[i][j] << "\t";
std::cout << "\n";
}
system("Pause");
}

b10533006 劉純賓 提到...

#include <iostream>
#include<cstdlib>

void matrixMul(int C[2][2], int A[2][2], int B[2][2])
{
for (int i = 0; i < 2; i++)
for (int j = 0; j < 2; j++) {
C[i][j] = 0;
for (int k = 0; k < 2; k++)
C[i][j] += A[i][k] * B[k][j];
}
}
int main()
{
int A[2][2] = { {1,2},{3,4} };
int B[2][2] = { { 1,1 },{ 2,2 } };
int C[2][2];
matrixMul(C, A, B);
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++)

std::cout << C[i][j] << "\t";
std::cout << "\n";

}

system("Pause");
return 0;

}

b10433081巫明芬 提到...

#include <iostream>
#include<cstdlib>

void matrixMul(int C[2][2], int A[2][2], int B[2][2])
{
for(int i=0;i<2;i++)
for (int j = 0; j < 2; j++) {
C[i][j] = 0;
for (int k = 0; k < 2; k++)
C[i][j] += A[i][k] * B[k][j];
}
}

int main()
{
int A[2][2] = { {1,2},{3,4} };
int B[2][2] = { {1,1},{2,2} };
int C[2][2];
matrixMul(C, A, B);
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++)
std::cout << C[i][j] << "\t";
std::cout << "\n";
}
system("Pause");
return 0;
}

B10533011 江道逸 提到...

#include <iostream>
#include <cstdlib>

void matrixMul(int C[2][2], int A[2][2],int B[2][2])
{
for (int i = 0; i < 2; i++)
for (int j = 0; j < 2; j++) {
C[i][j] = 0;
for (int k = 0; k < 2; k++)
C[i][j] += A[i][k] * B[k][j];
}
}
int main()
{
int A[2][2] = { {1,2},{3,4} };
int B[2][2] = { { 1,1 },{ 2,2 } };
int C[2][2] ;
matrixMul(C, A, B);
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++)
std::cout << C[i][j] << "\t";
std::cout << "\n";
}


system("Pause");
return 0;

}

B10533062 洪尚郁 提到...

#include
#include


using namespace std;

void matrixMul(int C[2][2], int A[2][2], int B[2][2] )
{
for (int i=0;i<2;i++)
for (int j = 0; j < 2; j++)
{
C[i][j] = 0;
for (int k = 0; k < 2; k++)
C[i][j] += A[i][k] * B[k][j];
}

}

int main()
{
int A[2][2] = { {1,2},{3,4} };
int B[2][2] = { { 1,2 },{ 3,4 } };
int C[2][2];

matrixMul(C, A, B);
for (int i = 0; i < 2; i++){
for (int j = 0; j < 2; j++)
cout << C[i][j];
cout << "\n";
}
system("pause");
return 0;


}

B10433107袁婕寧 提到...

#include
#include
void matrixMul(int C[2][2], int A[2][2], int B[2][2])
{
for (int i = 0; i<2; i++)
for (int j = 0; j < 2; j++) {
C[i][j] = 0;
for (int k = 0; k < 2; k++)
C[i][j] += A[i][k] * B[k][j];


}
}

int main()
{

int A[2][2] = { { 1,2 },{ 3,4 } };
int B[2][2] = { { 1,1 },{ 2,2 } };
int C[2][2];
matrixMul(C, A, B);
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++)
std::cout << C[i][j] << "\t";
std::cout << "\n";
}

system("Pause");
return 0;

}

B10433090蔡語鋐 提到...

#include <iostream>
#include <cstdlib>

void matrixMul(int C [2][2],int A [2] [2], int B [2] [2])
{
for(int i=0; i < 2; i++)
for (int j = 0; j < 2; j++) {
C [i][j] = 0;
for (int k = 0; k < 2; k++)
C[i][j] += A[i][k] * B[k][j];
}

}

int main()
{
int A[2][2] = { {1,2},{3,4} };
int B[2][2] = { { 1,1 },{ 2,2 } };
int C[2][2];
matrixMul(C, A, B);
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++)
std::cout << C[i][j]<<"\t";
std::cout << "\n";
}
system("Pause");
return 0;


}

B10433099駱婉婷 提到...

#include <iostream>
#include <cstdlib>
void matrixMul (int C[2][2],int A[2][2], int B[2][2])
{
for (int i=0 ;i<2 ;i++)
for (int j = 0; j < 2; j++) {
C[i][j] = 0;
for (int k = 0; k < 2; k++)
C[i][j] += A[i][k] * B[k][j];


}
}

int main()
{

int A[2][2] = { {1,2},{3,4} };
int B[2][2] = { { 1,1 },{ 2,2 } };
int C[2][2];
matrixMul(C, A, B);
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++)
std::cout << C[i][j] << "\t";
std::cout << "\n";
}

system("Pause");
return 0;

}

B10433090蔡語鋐 提到...

#include <iostream>
#include <cstdlib>

void matrixMul(int C [2][2],int A [2] [2], int B [2] [2])
{
for(int i=0; i < 2; i++)
for (int j = 0; j < 2; j++) {
C [i][j] = 0;
for (int k = 0; k < 2; k++)
C[i][j] += A[i][k] * B[k][j];
}

}

int main()
{
int A[2][2] = { {1,2},{3,4} };
int B[2][2] = { { 1,1 },{ 2,2 } };
int C[2][2];
matrixMul(C, A, B);
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++)
std::cout << C[i][j]<<"\t";
std::cout << "\n";
}
system("Pause");
return 0;


}

B10433094 簡筱芸 提到...

#include<iostream>
#include<cstdlib>

void matrixMul(int C[2][2], int A[2][2], int B[2][2]) {
for (int i = 0; i< 2; i++)
for (int j = 0; j < 2; j++) {
C[i][j] = 0;
for (int k = 0; k < 2; k++)
C[i][j] += A[i][k] * B[k][j];
}
}



int main()
{
int A[2][2] = { { 1,2 },{ 3,4 } };
int B[2][2] = { { 1,1 },{ 2,2 } };
int C[2][2];
matrixMul(C, A, B);
for (int i = 0; i < 2 ;i++){
for (int j = 0; j < 2; j++)

std::cout << C[i][j]<<"\t";
std::cout << "\n";



}
system("Pause");
return 0;


}

B10533007 魏辰熾 提到...

#include <iostream>
#include <cstdlib>


void matrixMul(int C[2][2], int A[2][2], int B[2][2])
{
for (int i = 0; i < 2; i++)
for (int j = 0; j < 2; j++) {
C[i][j] = 0;
for (int k = 0; k < 2; k++)
C[i][j] += A[i][k] * B[k][j];
}
}
int main()
{
int A[2][2] = { {1,2},{3,4} };
int B[2][2] = { { 1,1 },{ 2,2 } };
int C[2][2];
matrixMul(C, A, B);
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++)
std::cout << C[i][j] << "\t";
std::cout << "\n";
}
system("Pause");
return 0;


}

B10433073何明宗 提到...

#include <iostream>
#include <cstdlib>

void matrixMul(int C[2][2], int A[2][2],int B[2][2]){

for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++) {
C[i][j] = 0;
for (int k = 0; k < 2; k++) {
C[i][j] += A[i][k] * B[k][j];
}
}
}
}
int main()
{
int A[2][2] = { {1,1},{1,0} };
int B[2][2] = { {1,1},{2,2} };
int C[2][2];
matrixMul(C, A, B);
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++)
std::cout<< C[i][j] << "\t";
std::cout << "\n";
}

system("Pause");
return 0;
}

b10533008張士晟 提到...

#include <iostream>
#include <cstdlib>

void matrixMul(int C[2][2], int A[2][2],int B[2][2])
{
for (int i = 0; i < 2; i++)
for (int j = 0; j < 2; j++) {
C[i][j] = 0;
for (int k = 0; k < 2; k++)
C[i][j] += A[i][k] * B[k][j];
}
}
int main()
{
int A[2][2] = { {1,2},{3,4} };
int B[2][2] = { { 1,1 },{ 2,2 } };
int C[2][2] ;
matrixMul(C, A, B);
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++)
std::cout << C[i][j] << "\t";
std::cout << "\n";
}


system("Pause");
return 0;

}

b10533009 張仲崴 提到...

#include <iostream>
#include <cstdlib>

void matrixMu1(int C[2][2], int A[2][2], int B[2][2])
{
for (int i = 0; i < 2; i++)
for (int j = 0; j < 2; j++) {
C[i][j] = 0;
for (int k = 0; k < 2; k++)
C[i][j] += A[i][k] * B[k][j];
}
}
int main()
{
int A[2][2] = { {1,2},{3,4} };
int B[2][2] = { {1,1 },{ 2,2 } };
int C[2][2] ;
matrixMu1(C, A, B);
for (int i = 0; i < 2; i++){

for (int j = 0; j < 2; j++)
std::cout << C[i][j] << "\t";
std::cout << "\n";
}


system("Pause");
return 0;

B10533029游淑娥 提到...

#include
#include
void matrixMul(int C[2][2],int A[2][2],int B[2][2])
{
for (int i = 0;i<2;i++)
for (int j = 0; j < 2; j++) {
C[i][j] = 0;
for (int k = 0; k < 2; k++)
C[i][j] += A[i][k] * B[k][j];
}
}
int main()
{
int A[2][2] = { {1,2},{3,4,} };
int B[2][2] = { { 1,1 },{ 2,2, } };
int C[2][2];
matrixMul(C, A, B);
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++)
std::cout << C[i][j] << "\t";
std::cout << "\n";
}
system("Pause");
}

B10533018 陳郁傑 提到...

#include <iostream>
#include <cstdlib>


void matrixMul(int C[2][2], int A[2][2], int B[2][2])
{
for (int i = 0; i < 2; i++)
for (int j = 0; j < 2; j++) {
C[i][j] = 0;
for (int k = 0; k < 2; k++)
C[i][j] += A[i][k] * B[k][j];
}
}
int main()
{
int A[2][2] = { {1,2},{3,4} };
int B[2][2] = { { 1,1 },{ 2,2 } };
int C[2][2];
matrixMul(C, A, B);
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++)
std::cout << C[i][j] << "\t";
std::cout << "\n";
}
system("Pause");
return 0;


}

b10533004 李登恩 提到...

#include <iostream>
#include <cstdlib>
void matrixMul(int C[2][2], int A[2][2], int B[2][2])
{
for (int i = 0; i<2; i++)
for (int j = 0; j < 2; j++)
{
C[i][j] = 0;
for (int k = 0; k < 2; k++)
C[i][j] += A[i][k] * B[k][j];
}
}
int main()
{
int A[2][2] = { { 1,2 },{ 3,4 } };
int B[2][2] = { { 1,1 },{ 2,2 } };
int C[2][2];

matrixMul(C, A, B);
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++)

std::cout << C[i][j] << "\t";
std::cout << "\n";
}
system("Pause");

}

B10433065劉勝威 提到...

#include<iostream>
using namespace std;
int main(){

int h[2][2]={{1,2},
{3,4}};
int g[2][2]={{1,1},
{2,2}};

cout << "h Aarray = \n\n";
for(int i=0;i<2;i++){
for(int j=0;j<2;j++){
cout << h[i][j] << "\t" ;
}
cout << "\n";
}
cout << "\n";
cout << "g Aarray = \n\n";
for(int i=0;i<2;i++){
for(int j=0;j<2;j++){
cout << g[i][j] << "\t" ;
}
cout << "\n";
}
cout << "\n";
cout << "h * g Array = \n\n";
int hg[2][2]={{0,0},
{0,0}};
for(int i=0;i<2;i++){
for(int j=0;j<2;j++){
for(int k=0;k<2;k++){
hg[i][j]+=h[i][k]*g[k][j];

}
cout << hg[i][j] << "\t";
}
cout << "\n";
}
}

b10533017古峻衛 提到...

#include
#include

void matrixMul(int C[2][2], int A[2][2], int B[2][2])
{
for(int i=0; i<2; i++)
for (int j = 0; j < 2; j++) {
C[i][j] = 0;
for (int k = 0; k < 2; k++)
C[i][j] += A[i][k] * B[k][j];
}

}

int main()
{
intA[2][2] = { {1, 1},{1,0} };
intB[2][2] = { { 1, 1 },{ 2,2 } };
intC[2][2];
matrixMul(C, A, B);
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++)
std::cout << C[i][j] << "\t";
std::cout << "\n";

}
system("Pauge");
return 0;
}

B10433088葉凱文 提到...

#include
#include

void matrixMul(int C[2][2], int A[2][2],int B[2][2])
{
for (int i = 0; i < 2; i++)
for (int j = 0; j < 2; j++) {
C[i][j] = 0;
for (int k = 0; k < 2; k++)
C[i][j] += A[i][k] * B[k][j];
}
}
int main()
{
int A[2][2] = { {1,2},{3,4} };
int B[2][2] = { { 1,1 },{ 2,2 } };
int C[2][2] ;
matrixMul(C, A, B);
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++)
std::cout << C[i][j] << "\t";
std::cout << "\n";
}


system("Pause");
return 0;

}

b105 提到...

#include
#include

void matrixMul(int C[2][2], int A[2][2], int B[2][2])
{
for(int i=0; i<2; i++)
for (int j = 0; j < 2; j++) {
C[i][j] = 0;
for (int k = 0; k < 2; k++)
C[i][j] += A[i][k] * B[k][j];
}

}

int main()
{
intA[2][2] = { {1, 1},{1,0} };
intB[2][2] = { { 1, 1 },{ 2,2 } };
intC[2][2];
matrixMul(C, A, B);
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++)
std::cout << C[i][j] << "\t";
std::cout << "\n";

}
system("Pauge");
return 0;
}

b10533037 張俊為 提到...

#include
#include

void matrixMul(int C[2][2], int A[2][2], int B[2][2])
{
for(int i=0; i<2; i++)
for (int j = 0; j < 2; j++) {
C[i][j] = 0;
for (int k = 0; k < 2; k++)
C[i][j] += A[i][k] * B[k][j];
}

}

int main()
{
intA[2][2] = { {1, 1},{1,0} };
intB[2][2] = { { 1, 1 },{ 2,2 } };
intC[2][2];
matrixMul(C, A, B);
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++)
std::cout << C[i][j] << "\t";
std::cout << "\n";

}
system("Pauge");
return 0;
}

b10533019 葉佳倫 提到...

#include
#include

void matrixMul(int C[2][2], int A[2][2], int B[2][2])
{
for(int i=0; i<2; i++)
for (int j = 0; j < 2; j++) {
C[i][j] = 0;
for (int k = 0; k < 2; k++)
C[i][j] += A[i][k] * B[k][j];
}

}

int main()
{
intA[2][2] = { {1, 1},{1,0} };
intB[2][2] = { { 1, 1 },{ 2,2 } };
intC[2][2];
matrixMul(C, A, B);
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++)
std::cout << C[i][j] << "\t";
std::cout << "\n";

}
system("Pauge");
return 0;
}

B10533071徐琮淇 提到...

#include
#include

void matrixMu1(int C[2][2], int A[2][2], int B[2][2])
{
for (int i = 0; i < 2; i++)
for (int j = 0; j < 2; j++) {
C[i][j] = 0;
for (int k = 0; k < 2; k++)
C[i][j] += A[i][k] * B[k][j];
}
}
int main()
{
int A[2][2] = { {1,2},{3,4} };
int B[2][2] = { {1,1 },{ 2,2 } };
int C[2][2] ;
matrixMu1(C, A, B);
for (int i = 0; i < 2; i++){

for (int j = 0; j < 2; j++)
std::cout << C[i][j] << "\t";
std::cout << "\n";
}


system("Pause");
return 0;

b10514033盧昱仁 提到...

#include
#include

void matrixMul(int C[2][2], int A[2][2], int B[2][2])
{
for(int i=0; i<2; i++)
for (int j = 0; j < 2; j++) {
C[i][j] = 0;
for (int k = 0; k < 2; k++)
C[i][j] += A[i][k] * B[k][j];
}

}

int main()
{
intA[2][2] = { {1, 1},{1,0} };
intB[2][2] = { { 1, 1 },{ 2,2 } };
intC[2][2];
matrixMul(C, A, B);
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++)
std::cout << C[i][j] << "\t";
std::cout << "\n";

}
system("Pauge");
return 0;
}

b10533038楊尹玄 提到...

#include
#include

void matrixMul(int C[2][2], int A[2][2], int B[2][2])
{
for(int i=0; i<2; i++)
for (int j = 0; j < 2; j++) {
C[i][j] = 0;
for (int k = 0; k < 2; k++)
C[i][j] += A[i][k] * B[k][j];
}

}

int main()
{
intA[2][2] = { {1, 1},{1,0} };
intB[2][2] = { { 1, 1 },{ 2,2 } };
intC[2][2];
matrixMul(C, A, B);
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++)
std::cout << C[i][j] << "\t";
std::cout << "\n";

}
system("Pauge");
return 0;
}

b10533032程泓瑋 提到...

#include
#include

void matrixMul(int C[2][2], int A[2][2], int B[2][2])
{
for(int i=0; i<2; i++)
for (int j = 0; j < 2; j++) {
C[i][j] = 0;
for (int k = 0; k < 2; k++)
C[i][j] += A[i][k] * B[k][j];
}

}

int main()
{
intA[2][2] = { {1, 1},{1,0} };
intB[2][2] = { { 1, 1 },{ 2,2 } };
intC[2][2];
matrixMul(C, A, B);
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++)
std::cout << C[i][j] << "\t";
std::cout << "\n";

}
system("Pauge");
return 0;
}

b10533031沈宏儒 提到...

#include
#include

void matrixMul(int C[2][2], int A[2][2], int B[2][2])
{
for(int i=0; i<2; i++)
for (int j = 0; j < 2; j++) {
C[i][j] = 0;
for (int k = 0; k < 2; k++)
C[i][j] += A[i][k] * B[k][j];
}

}

int main()
{
intA[2][2] = { {1, 1},{1,0} };
intB[2][2] = { { 1, 1 },{ 2,2 } };
intC[2][2];
matrixMul(C, A, B);
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++)
std::cout << C[i][j] << "\t";
std::cout << "\n";

}
system("Pauge");
return 0;
}

B10533132許敏茹 提到...

#include<iostream>
#include<cstdlib>

void matrixMul(int c[2] [2], int A[2][2]), int B[2][2]
{
for (int i = 0; i<2;i++)
for (int j = 0; j < 2; j++) {
C[i][j] = 0;
for (int K = 0; K < 2; K++)
C[i][j] += A[i][k] * B[k][j];
}
}
int main()
{
int A[2][2] = { {1,2},{3,4} };
int B[2][2] = { {1,1},{ 2,2 } };
int C[2][2];
matrixMul(C, A, B);
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++)
std::cout << C[i][j] << "\t";
std::cout << "\n";
}

B10433102楊婷妤 提到...

#include<iostream>
using namespace std;
int main(){

int h[2][2]={{1,2},
{3,4}};
int g[2][2]={{1,1},
{2,2}};

cout << "h Aarray = \n\n";
for(int i=0;i<2;i++){
for(int j=0;j<2;j++){
cout << h[i][j] << "\t" ;
}
cout << "\n";
}
cout << "\n";
cout << "g Aarray = \n\n";
for(int i=0;i<2;i++){
for(int j=0;j<2;j++){
cout << g[i][j] << "\t" ;
}
cout << "\n";
}
cout << "\n";
cout << "h * g Array = \n\n";
int hg[2][2]={{0,0},
{0,0}};
for(int i=0;i<2;i++){
for(int j=0;j<2;j++){
for(int k=0;k<2;k++){
hg[i][j]+=h[i][k]*g[k][j];

}
cout << hg[i][j] << "\t";
}
cout << "\n";
}
}

B10533010蕭凱維 提到...

#include <iostream>
#include<cstdlib>

void matrixMul(int C[2][2], int A[2][2], int B[2][2])
{
for (int i = 0; i < 2; i++)
for (int j = 0; j < 2; j++) {
C[i][j] = 0;
for (int k = 0; k < 2; k++)
C[i][j] += A[i][k] * B[k][j];
}
}
int main()
{
int A[2][2] = { { 1,2 },{ 3,4 } };
int B[2][2] = { { 1,1 },{ 2,2 } };
int C[2][2];
matrixMul(C, A, B);
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++)

std::cout << C[i][j] << "\t";
std::cout << "\n";
}
system("Pause");
return 0;
}

B10537208 楊蕊筑 提到...

#include
#include

void matrixMul(int C[2][2], int A[2][2])
{
for (int i = 0; j < 2; j++)
for (int j = 0; j < 2; j++) {
C[i][j] = 0;
for (int k = 0; k < 2; k++)
C[i][j] += A[i][k] * B[k][j];
}

}
int main()
{
int A[2][2] = { {1, 1},{1,0} };
int B[2][2] = { {1, 1 },{ 2,2 } };
int C[2][2];
matrixMul(C, A, B);
for (int i = 0; i < 2; i++) {
for (int i = 0; j < 2; j++)
std::cout << C[i][j]<<"\t";
std::cout << "\n";
}
system("Pause");
return 0;
}

B10533010蕭凱維 提到...

#include <iostream>
#include<cstdlib>

void matrixMul(int C[2][2], int A[2][2], int B[2][2])
{
for (int i = 0; i < 2; i++)
for (int j = 0; j < 2; j++) {
C[i][j] = 0;
for (int k = 0; k < 2; k++)
C[i][j] += A[i][k] * B[k][j];
}
}
int main()
{
int A[2][2] = { { 1,2 },{ 3,4 } };
int B[2][2] = { { 1,1 },{ 2,2 } };
int C[2][2];
matrixMul(C, A, B);
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++)

std::cout << C[i][j] << "\t";
std::cout << "\n";
}
system("Pause");
return 0;
}

B10533132許敏茹 提到...

#include<iostream>
#include<cstdlib>

void matrixMul(int c[2] [2], int A[2][2]), int B[2][2]
{
for (int i = 0; i<2;i++)
for (int j = 0; j < 2; j++) {
C[i][j] = 0;
for (int K = 0; K < 2; K++)
C[i][j] += A[i][k] * B[k][j];
}
}
int main()
{
int A[2][2] = { {1,2},{3,4} };
int B[2][2] = { {1,1},{ 2,2 } };
int C[2][2];
matrixMul(C, A, B);
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++)
std::cout << C[i][j] << "\t";
std::cout << "\n";
}

B10533087湯秉鈞 提到...

#include
#include

void matrixMul(int C[2][2], int A[2][2], int B[2][2])
{
for(int i=0; i<2; i++)
for (int j = 0; j < 2; j++) {
C[i][j] = 0;
for (int k = 0; k < 2; k++)
C[i][j] += A[i][k] * B[k][j];
}

}

int main()
{
intA[2][2] = { {1, 1},{1,0} };
intB[2][2] = { { 1, 1 },{ 2,2 } };
intC[2][2];
matrixMul(C, A, B);
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++)
std::cout << C[i][j] << "\t";
std::cout << "\n";

}
system("Pauge");
return 0;
}

B10433071雷昕翰 提到...

#include
#include

void matrixMul(int C[2][2], int A[2][2], int B[2][2])
{
for(int i=0; i<2; i++)
for (int j = 0; j < 2; j++) {
C[i][j] = 0;
for (int k = 0; k < 2; k++)
C[i][j] += A[i][k] * B[k][j];
}

}

int main()
{
intA[2][2] = { {1, 1},{1,0} };
intB[2][2] = { { 1, 1 },{ 2,2 } };
intC[2][2];
matrixMul(C, A, B);
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++)
std::cout << C[i][j] << "\t";
std::cout << "\n";

}
system("Pauge");
return 0;
}

B10433071雷昕翰 提到...

#include

void matrixMul(int C[2][2], int A[2][2], int B[2][2])
{
for(int i=0; i<2; i++)
for (int j = 0; j < 2; j++) {
C[i][j] = 0;
for (int k = 0; k < 2; k++)
C[i][j] += A[i][k] * B[k][j];
}

}

int main()
{
intA[2][2] = { {1, 1},{1,0} };
intB[2][2] = { { 1, 1 },{ 2,2 } };
intC[2][2];
matrixMul(C, A, B);
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++)
std::cout << C[i][j] << "\t";
std::cout << "\n";

}
system("Pauge");
return 0;
}

B10533088葉俊江 提到...

#include
#include

void matrixMul(int C[2][2], int A[2][2])
{
for (int i = 0; j < 2; j++)
for (int j = 0; j < 2; j++) {
C[i][j] = 0;
for (int k = 0; k < 2; k++)
C[i][j] += A[i][k] * B[k][j];
}

}
int main()
{
int A[2][2] = { {1, 1},{1,0} };
int B[2][2] = { {1, 1 },{ 2,2 } };
int C[2][2];
matrixMul(C, A, B);
for (int i = 0; i < 2; i++) {
for (int i = 0; j < 2; j++)
std::cout << C[i][j]<<"\t";
std::cout << "\n";
}
system("Pause");
return 0;
}

b10333093 徐子軒 提到...

#include
#include
void matrixMul(int C[2][2], int A[2][2], int B[2][2])
{
for (int i = 0; i<2; i++)
for (int j = 0; j < 2; j++) {
C[i][ j ] = 0;
for (int k = 0; k < 2;k++)
C[i][j] += A[i][k] * B[k][j];
}
}
int main()
{
int A[2][2] = { { 1,2 },{ 3,4 } };
int B[2][2] = { { 1,1 },{ 2,2 } };
int C[2][2];
matrixMul(C, A, B);
for (int i = 0; i < 2; i++) {
for(int j=0;j<2;j++)
std::cout << C[i][j] << "\t";
std::cout << "\n";
}
system("Pause");
}

B10533083徐士興 提到...

#include
#include

void matrixMul(int C[2][2], int A[2][2])
{
for (int i = 0; j < 2; j++)
for (int j = 0; j < 2; j++) {
C[i][j] = 0;
for (int k = 0; k < 2; k++)
C[i][j] += A[i][k] * B[k][j];
}

}
int main()
{
int A[2][2] = { {1, 1},{1,0} };
int B[2][2] = { {1, 1 },{ 2,2 } };
int C[2][2];
matrixMul(C, A, B);
for (int i = 0; i < 2; i++) {
for (int i = 0; j < 2; j++)
std::cout << C[i][j]<<"\t";
std::cout << "\n";
}
system("Pause");
return 0;
}

b10533075 陳詔瑋 提到...

#include
#include

void matrixMul(int C[2][2], int A[2][2],int B[2][2])
{
for (int i = 0; i < 2; i++)
for (int j = 0; j < 2; j++) {
C[i][j] = 0;
for (int k = 0; k < 2; k++)
C[i][j] += A[i][k] * B[k][j];
}
}
int main()
{
int A[2][2] = { {1,2},{3,4} };
int B[2][2] = { { 1,1 },{ 2,2 } };
int C[2][2] ;
matrixMul(C, A, B);
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++)
std::cout << C[i][j] << "\t";
std::cout << "\n";
}


system("Pause");
return 0;

}

b10533029 游淑娥 提到...

#include
#include

void matrixMul(int C[2][2], int A[2][2],int B[2][2])
{
for (int i = 0; i < 2; i++)
for (int j = 0; j < 2; j++) {
C[i][j] = 0;
for (int k = 0; k < 2; k++)
C[i][j] += A[i][k] * B[k][j];
}
}
int main()
{
int A[2][2] = { {1,2},{3,4} };
int B[2][2] = { { 1,1 },{ 2,2 } };
int C[2][2] ;
matrixMul(C, A, B);
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++)
std::cout << C[i][j] << "\t";
std::cout << "\n";
}


system("Pause");
return 0;

}

B10533093許永炎 提到...

#include
#include

void matrixMul(int C[2][2], int A[2][2],int B[2][2])
{
for (int i = 0; i < 2; i++)
for (int j = 0; j < 2; j++) {
C[i][j] = 0;
for (int k = 0; k < 2; k++)
C[i][j] += A[i][k] * B[k][j];
}
}
int main()
{
int A[2][2] = { {1,2},{3,4} };
int B[2][2] = { { 1,1 },{ 2,2 } };
int C[2][2] ;
matrixMul(C, A, B);
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++)
std::cout << C[i][j] << "\t";
std::cout << "\n";
}


system("Pause");
return 0;

}

Related Posts Plugin for WordPress, Blogger...

熱門文章