Write a program to read two matrices of real numbers (up to 10 x 10 in size) and print out the number of rows which are identical between the two matrices and the number of columns which are identical. The input consists of two integers, r and c, specifying the number of rows and columns in the matrices (they have the same dimensions), followed by the values of matrix1 (r rows of c real numbers) followed by the values of matrix2 (r rows of c real numbers). Your program must consist of a main program and the following two functions.
int count_equal_rows(int r, int c, double matrix1[][10], double matrix2[]][10])
int count_equal_colums(int r, int c, double matrix1[][10], double matrix2[]][10])
my program:
int count_equal_rows(int r, int c, double matrix1[][10], double matrix2[][10])
{
int match=0,i,j,row,col;
scanf("%d%d%lf%lf",&row,&col,&matrix1[i][j],&matrix2[i][j]);
for(i=0;i
{
if (matrix1[i][j]= matrix2[i][j])
match +=1;
}
return(match);
}
2006-12-09
07:29:19
·
4 answers
·
asked by
skyrider
2