All functions compile except the max function where i am trying to get it to find the maximum number in the matrix. The error message says overloaded function with no contextual type information Please tell me why.
#include <iomanip>
#include <iostream>
using namespace std;
const int ROW = 3; //global const for # of rows
const int COL = 3; //global const for # of columns
const int LOW = 1; //lower limit
const int UP = 10; // upper limit
const int LOWer = 10; //global const for the lower limit
const int UPer = 100; //global const for the upper limit
// Function prototypes:
void ZeroArray(int[][COL], int, int); //function prototype
void PrintArray(int[][COL], int, int); //function prototype
void GenerateArray(int[][COL], int, int, int, int); //function prototype
int SumArray(int[][COL], int, int); //function prototype
int FindMax(int[][COL], int, int); //function prototype
int main(void)
{
int table[ROW][COL]; //array declaration
int total; //return from function
int min; //return from function
ZeroArray(table, ROW, COL); //function call
PrintArray(table, ROW, COL); //function call
srand(time(NULL));
GenerateArray(table, ROW, COL, LOWer, UPer);
total = SumArray(table, ROW, COL); //function call
//problem with max findmax is here
max = FindMax(table, ROW, COL); //function calll
return 0;
}
//zero out
void ZeroArray(int t[][COL], int row, int col){
for (int r = 0; r < row; r++)
for (int c = 0; c < col; c++)
t[r][c] = 0;
}
//random
void GenerateArray(int t[][COL], int row, int col, int lower_limit, int upper_limit){
for (int r = 0; r < row; r++)
for (int c = 0; c < col; c++)
t[r][c] = rand()%(upper_limit - lower_limit + 1) + lower_limit;
}
//print
void PrintArray(int t[][COL], int row, int col){
for (int r = 0; r < row; r++){
for (int c = 0; c < col; c++)
cout << setw(5) << t[r][c];
cout << endl;
}
}
//sum
int SumArray(int t[][COL], int row, int col){
int sum = 0;
for (int r = 0; r < row; r++)
for (int c = 0; c < col; c++)
sum = sum + t[r][c];
return sum;
}
//max
int FindMax(int t[][COL], int row, int col){
int max = t[0][0];
for (int r = 0; r < row; r++)
for (int c = 0; c < col; c++)
if(t[r][c] > max)
max = t[r][c];
return max;
}