// Muhammad Rafly	
// A19CS5073

#include <iostream>
#include <iomanip>
using namespace std;

const int MAXCOLS=10;
const int MAXROWS=10;

typedef float priceType[MAXCOLS] [MAXROWS];

void getPrices (priceType, int&, int&);
void printPrices(priceType, int, int);
float findHighestPrice(priceType table, int,  int);
float findLowestPrice(priceType table, int, int);


int main()
{
	int rowsUsed;
	int columsUsed;
	priceType table;	
	getPrices(table, rowsUsed, columsUsed );
	printPrices(table, rowsUsed,columsUsed );
	cout << "The Big Prices is" << findHighestPrice(table, rowsUsed, columsUsed) << endl;
	cout << "the Lowest Proces" << findLowestPrice (table, rowsUsed, columsUsed) << endl;
	
	return 0;
}

void getPrices(priceType table, int& numofRows, int&numofCols )
{

	cout << "Please input the number of rows from 1 to " << MAXROWS << endl;
	cin >> numofRows;
	
	cout << "Please input the number of columns from 1 to "<< MAXCOLS << endl;
	cin >> numofCols;
	for (int row = 0; row < numofRows; row++ )
	{
		for (int col = 0; col < numofCols; col++)
		{
			cout << "Please input the price of an item with 2 decimal places " << endl;
			cin >> table [col] [row];
			col*row;
	    }
	}
	
}

void printPrices(priceType table, int numofRows, int numofCols)
{
	cout << fixed << showpoint << setprecision(2);
	
	for (int row = 0; row < numofRows; row++)
	{
		cout << "\t";
		for (int col= 0; col < numofCols; col++)
		{
			cout << setw(8) << left << table [row] [col];
		}
		cout << endl;
	}
}

float findHighestPrice(priceType table, int numOfRows, int numOfCols)  

{                         
	float highestPrice; 
 	highestPrice = table[0][0]; 
 	for (int row = 0; row < numOfRows; row++) 
	 	for (int col = 0; col < numOfCols; col++) 
		 	if ( highestPrice < table[row][col] )  
			highestPrice = table[row][col]; 
 
return highestPrice; 
}

float findLowestPrice(priceType table, int numOfRows, int numOfCols)  

{                         
	float LowestPrice; 
 	LowestPrice = table[0][0]; 
 	for (int row = 0; row < numOfRows; row++) 
	 	for (int col = 0; col < numOfCols; col++) 
		 	if ( LowestPrice < table[row][col] )  
			LowestPrice = table[row][col]; 
 
return LowestPrice; 
}
