I want your help to fix this code to make it work as in the picture bellow
. The third arry s[] is the multipication of p[] * q []
http://www.2shared.com/fadmin/4394350/96972f59/12_online.gif
This is the code :
# include <iostream>
using namespace std;
int main()
{
int r,c,k=0,i=0,p[3][5],q[5][3],s[3][3];
for(r=0;r<3;r++)
for(c=0;c<5;c++)
p[r][c]=0;
cout<<"enter the elements of the Array p\n";
for(r=0;r<3;r++)
{
for(c=0;c<5;c++)
{
cout<<"enter the elements of for row " <<r+1<<"and column " <<c+1<<" ";
cin>>i;
if (i<0)
break;
else
p[r][c]=i;
}
}
cout<<" \n the elements of the array p are\n\n";
for(r=0;r<3;r++){
for(c=0;c<5;c++)
{cout<<p[r][c]<<"\t";}
cout<<"\n";}
for(r=0;r<5;r++)
for(c=0;c<3;c++)
q[r][c]=0;
cout<<"enter the elements of the Array q\n";
for(r=0;r<5;r++)
{
for(c=0;c<3;c++)
{
cout<<"enter the elements of for row " <<r+1<<"and column " <<c+1<<" ";
cin>>i;
if (i<0)
break;
else
q[r][c]=i;
}
}
cout<<" \n the elements of the array q are\n\n";
for(r=0;r<5;r++){
for(c=0;c<3;c++)
{cout<<q[r][c]<<"\t";}
cout<<"\n";}
cout<<" \n the elements of the array S=PxQ are\n\n";
for (int i=0; i<r; i++) {
for (int j=0; j<c; j++) {
int val = p[i][] * p[r][c];
s[i][j]=val;
cout<<s[r][c]<<"\t";}
cout<<"\n";
}
getchar();
getchar();
}