Write a function called biggestEntry( ) that uses a two dimensional array and two parameters representing the row and column capacities. The function should return the value of the biggest entry in the array. For example, a program that uses the function biggestEntry follows.
int main()
{
int x[2][3] = {{1,2,3},{4,7,3}};
biggestEntry(x, 2, 3)
It should print 7 (since 7 is the biggest entry in the array)
#include<iostream.h>
#include<conio.h>
int BiggestEntry( int arr[3][4] );
// what about " two parameters representing the row and column"?
void main()
{
clrscr();
int a, b, x[3][4]={12,32,43,5,1,14,25,60,16,23,67,97}, max;
for (a=0;a<3;a++)
for (b=0;b<4;b++)
max = (x[3][4]); // out of range error: array x[3][4] does not have element x[3][4]
// besides, setting max to same value for 12 times is excessive
// the function BiggestEntry is never called by this program
cout<<"Biggest entry is="<<max<<endl;
getch();
}
int BiggestEntry(int arr[3][4])
{
int i,j,Biggest;
Biggest=arr[0][0];
for (i=0;i<3;i++)
for (j=0;j<4;j++)
if (arr[i][j] > Biggest)
Biggest = arr[i][j];
return Biggest;
}