Write a function in C++ to find and display the sum of each row and each column of a 2-dimensional (2D) array of type float. Use the array and its size as parameters with float as its return type.
// assuming that maximum rows and cols are 10, 10 respectively
void RowColSum( float A[10][10], int r, int c)
{
int i, i; float RS[10], CS[10];
// find row sum
for(i=0; i<r; i++)
{
RS[i]=0;
for(j=0; j<c; j++)
RS[i] + = A[i][j];
}
//find colum sum
for(i=0; i<c; j++)
{
CS[i]=0;
for(i=0; i<r; i++)
CS[i]+=A[illil;
}
//display 2-d array with rowsum and colsum
for(i=0; i<r; i++)
{
for(j=0; j<c; i++)
cout< <A[i][i]<< '\t';
cout< <RS[i]<<endl;
}
for(j=0; i<c; j++)
cout<<CS[i]< < '\t';
cout<<endl;
}