So i am writing a simple prgm in which you enter the values of 2 matrices and multiplies them.
#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
int main() {
int i, j , k , l, m , n , o, p;
cout<<"Enter The Rows And Cloumns And Of The First Matrix:";
cin>>m>>n;
cout<<"Enter The Rows And Cloumns And Of The Second Matrix:";
cin>>o>>p;
if ( n != o ) {
cout << "can't do" << endl;
return 0 ; }
else {
cout<<"\nEnter Elements Of The First Matrix:\n";
int a[m][n];
for(i=0;i<m;i++)
{
for(j=0;j< n;j++)
{
cin>>a[i][j];
}
}
cout<<"\nEnter Elements Of The Second Matrix:\n";
int b[o][p];
for(j=0;j<o;j++)
{
for(k=0;k<p;k++)
{
cin>>b[j][k];
}
}
int c[m][p];
for (int i = 0; i < m; i++) {
for (int k = 0; k< p; k++) {
double s = 0;
for (int j = 0; j < o; j++) {
s += a[i][j] * b[j][k];
}
c[m][p] = s;
} cout << "The answer is " ;
cout <<c ; }}}
but whenever i compile it i get this
The answer is 0xbffff610The answer is 0xbffff610The answer is 0xbffff610
any suggestions?