The below problem is to find the kth power of a matrix.

Code:#include<iostream> using namespace std; int main() { double **a; int r,k; double **matrixExpon(double**,int); cout<<"the no of rows in the matrix is"<<endl; cin>>r; a=new double*[r]; for(int i=0;i<r;i++) { a[i]=new double(r); } cout<<"Value of k is "<<endl; cin>>k; for(int i=1;i<k;i++) a=matrixExpon(**a,r); } double **matrixExpon(double **a,int r) { double **b; b=new double *[r]; int i; for(i=0;i<r;i++) { b[i]=new double [r]; } int j,k,sum=0; for(i=0;i<=r;i++) { for(j=0;j<=r;j++) { for(k=0;k<=r;k++) sum=sum+a[i][k]*a[k][j]; b[i][j]=sum; sum=0; } } return b; }

Compilation Error :

cannot convert ‘double’ to ‘double**’ for argument ‘1’ to ‘double** matrixExpon(double**, int)’|

please help here..