#include <iostream>
using namespace std;
int main()
{
int n,i,j;
cout << "matris boyutu gir : ";
cin >> n;
double u[n][n], l[n][n];
double s[n][n] = {};
cout << "1. matris" << endl;
for (i = 0; i<n; ++i)
for (j = 0; j<n; ++j){
cout << "[" << i+1 << "][" << j+1 <<"] : ";
cin >> l[i][j];
}
cout << endl <<"2. matris" << endl;
for (i = 0; i<n; ++i)
for (j = 0; j<n; ++j){
cout << "[" << i+1 << "][" << j+1 <<"] : ";
cin >> u[i][j];
}
cout << endl << "Sonuc" << endl;
for(int r = 0; r<i; r++){
for(int c=0; c<j; c++){
for(int in=0; in <i; in++){
s[r][c] += l[r][in]*u[in][c];
}
cout << s[r][c] << " ";
}
cout << endl;
}
return 0;
}
29 Ekim 2016 Cumartesi
C++ Matris Çarpımı (nxn)
Kaydol:
Kayıt Yorumları (Atom)
Hiç yorum yok:
Yorum Gönder