/**************************** * * * * * CSCI 1470, Fall 2005 * * MP10 * * Purpose: Manipulate data * * using strings. * ****************************/ #include #include //constant variables const int MAXROWS = 100; const int MAXCOLUMNS = 100; //prototypes for the functions void get_data(double [][MAXCOLUMNS] ,int&,int&); double max(double [][MAXCOLUMNS], int, int); double min(double [][MAXCOLUMNS], int, int); double sum(double [][MAXCOLUMNS], int, int); double avg(double [][MAXCOLUMNS], int, int); void printdata(double [][MAXCOLUMNS], int, int); using namespace std; int main(void) { int num_row, num_column; double a[MAXROWS][MAXCOLUMNS]; get_data(a, num_row, num_column); //output the returns of the functions cout << endl << endl << "The max of the matrix is: " << setprecision(3) << fixed << showpoint << max(a,num_row,num_column) << endl; cout << "The min of the matrix is: " << min(a,num_row,num_column) << endl; cout << "The sum of the matrix is: " << sum(a,num_row,num_column) << endl; cout << "The average of the matrix is: " << avg(a, num_row,num_column) << endl << endl << endl; cout << "The entered data was:" << endl << endl; printdata(a,num_row,num_column); cout << endl; return 0; }//end of function main //function gets data from the user void get_data(double x[][MAXCOLUMNS], int& num_row, int& num_column) { cout << "Enter number of rows(less than or equal to 100): "; cin >> num_row; cout << endl << "Enter the number of columns(less than or equal to 100): "; cin >> num_column; for (int i=0; i> x[i][j]; } return; }//end of function get_data //function returns the max of the entered data double max(double x[][MAXCOLUMNS], int num_rows, int num_columns) { double temp; temp = x[0][0]; for (int i=0; i temp) temp = x[i][j]; } } return temp; }//end of function max //function returns the min of the entered data double min(double x[][MAXCOLUMNS], int num_rows, int num_columns) { double temp; temp = x[0][0]; for (int i=0; i