tags:

views:

96

answers:

1

I need to write a function that pick out the greatest number from the matrix of integers. The matrix is passed to the function through pointer type argument. The number of rows and columns are also passed to the function through arguments. The function should return the greatest number of the matrix elements.

I need to use this function in a program to read a (m*n) matrix from a disk file 'matrix.dat', where m is the number of rows and n is the number of columns. Assume that the data file initially has values for m and n and then the matrix elements are stored.

+3  A: 

Well:

  • Start with the first element and save it.
  • For each other element compare it with the saved one and save it if it is the greatest.
  • In the end you have the greatest value.

Don't forget to panic if the matrix has 0 or less rows or columns.

Gamecat
And next time, show a little more effort. You learn most from your own mistakes.
Gamecat