بسم الله الرحمن الرحيم
اريد تصحيح هذا الكود ان امكن وبسرعة عاجلة
وهذا نص السوال
Write a program that reads 3 positive integers M,N and K. The program does the following:
1. Create two dynamic matrices of integers A=MxN and B=NxK .
2. Read the values of the two matrices A,B from the keyboard.
3. Multiply A, B and store the result in a dynamic matrix D, then display the result on screen.
4. Delete all allocated memory.
#include <iostream.h>
void main(){
int M,N,K;
int **A;
int **B;
int **D;
int sum=0;
cout<<"inputinteger rows and culm:";
cin>>M>>N>>K;
cout<<"INPUT THE FIRST MATRIX ";
A= new int *[M];
for (int i=0;i<M;i++)
{
*(A+i)=new int[N];
for(int j=0;j<N;j++)
cin>>*(*(A+i)+j);
}
cout<<"input the second matrix ";
B=new int*[N];
for(i=0;i<N;i++)
{
*(B+i)=new int[K];
for(int j=0;j<K;j++)
cin>>*(*(B+i)+j);
}
D=new int *[M];
for(i=0;i<M;i++)
*(D+1)=new int[K];
for(i=0;i<M;i++)
for(int h=0;h<K;h++)
{
sum=0;
for(int e=0;e<N;e++)
sum+=*(*(A+i)+e)**(*(B+e)+h);
*(*(D+i)+h)=sum;
}
cout<<"the multiply is :"<<endl<<endl;
for(i=0;i<M;i++)
for (int j=0;j<K;j++)
cout<<*(*(D+i)+i)<<"";
cout<<endl;
for (i=0;i<M;i++)
delete[]*(A+i);
delete[]A;
A='\0';
for(i=0;i<N;i++)
delete[]*(B+i);
delete[]B;
B='\0';
for(i=0;i<M;i++)
delete[]*(D+i);
delete[]D;
D='\0';
}