- /* 14 . 印出兩個N*N矩陣的乘積 */
- #include<iostream>
- using namespace std;
- int main()
- {
- int n=10 ;
-
- int a[n][n];
-
- int b[n][n];
-
- int c[n][n] ;
-
- for( int i=0 ;i<n ;i++){
-
- for( int j=0 ;j<n ;j++){
-
- a[i][j]=(rand()%10);
-
- cout << a[i][j] << " " ;
-
- b[i][j]=(rand()%10);
-
- cout << b[i][j] << " " ;
-
- c[i][j]= a[i][j] * b[i][j];
-
- cout << c[i][j] << endl;
-
- }
- }
-
- system("pause");
-
- return 0;
- }
複製代碼 |