Code:

ABrec(A,B)
n=A.rows; //n must be multiple of 2
C is a new n*n matrix.
if(n==1)
C[0][0]=A[0][0]*B[0][0];
else
we partion A,B,C into 4 parts;
C00=ABrec(A00,B00)+Arec(A10,B01);
C01=ABrec(A00,B01)+Arec(A01,B11);
C10=ABrec(A10,B11)+Arec(A11,B10);
C11=ABrec(A10,B01)+Arec(A11,B11);
return C;

heres my code,
Code:

#include <iostream>
using namespace std;
void Add(int **A,int **B,int **C,int n)
{
for(int i=0;i<n;++i)
{
for(int j=0;j<n;++j)
C[i][j]+=A[i][j]+B[i][j];
}
return;
}
int **AB(int **A,int **B,int **C,int n)
{
for(int i=0;i<n;++i)
{
for(int j=0;j<n;++j)
{
C[i][j]=0;
for(int k=0;k<n;++k)
C[i][j]+=A[i][k]*B[k][j];
}
}
}
int **ABrec(int **A,int **B,int **C,int n)
{
if(n==1)
C[0][0]=A[0][0]*B[0][0];
else
{
int **A00=A,**A01=A+1,**A10=A+2,**A11=A+3;
int **B00=B,**B01=B+1,**B10=B+2,**B11=B+3;
int **C00=C,**C01=C+1,**C10=C+2,**C11=C+3;
Add(ABrec(A00,B00,C00,n/2),ABrec(A01,B10,C00,n/2),C00,n/2);
Add(ABrec(A00,B01,C01,n/2),ABrec(A00,B11,C01,n/2),C01,n/2);
Add(ABrec(A10,B00,C10,n/2),ABrec(A11,B10,C10,n/2),C10,n/2);
Add(ABrec(A10,B01,C11,n/2),ABrec(A11,B11,C11,n/2),C11,n/2);
}
return C;
}
int main()
{
int **A=new int*[16],**B=new int*[16],**C=new int*[16];
for(int i=0;i<16;++i)
{
A[i]=new int[16];
B[i]=new int[16];
C[i]=new int[16];
}
for(int i=0;i<16;++i)
{
for(int j=0;j<16;++j)
{
A[i][j]=B[i][j]=C[i][j]=j+1;
}
}
C=ABrec(A,B,C,16);
}

but the code doesnt work !!!