#include #include using namespace std; // Global variables const int MAX_ROWS = 50; const int MAX_COLS = 50; // Notice that function prototypes need not include the variable names. void read_matrix( double [MAX_ROWS][MAX_COLS], int&, int& ); void prnt_matrix( double [MAX_ROWS][MAX_COLS], int, int, short ); int main() { double matrix[MAX_ROWS][MAX_COLS]; int rows, cols; read_matrix( matrix, rows, cols ); cout << "\n"; prnt_matrix( matrix, rows, cols, 8 ); cout << "\n\n"; system( "PAUSE" ); return( EXIT_SUCCESS ); } void read_matrix( double array[MAX_ROWS][MAX_COLS], int &rows, int &cols ) { cout << "Enter the number of rows and columns.\n" << "# of Rows = "; cin >> rows; cout << "# of Columns = "; cin >> cols; cout << endl; for ( int i = 0; i < rows; i++ ) { for ( int j = 0; j < cols; j++ ) { cout << "Entry [" << i << "][" << j << "] = "; cin >> array[i][j]; } } } #include void prnt_matrix( double array[MAX_ROWS][MAX_COLS], int rows, int cols, short prt_width ) { cout << setiosflags( ios::left ); for ( int i = 0; i < rows; i++ ) { for ( int j = 0; j < cols; j++ ) { cout << setw( prt_width ) << array[i][j] << " "; } cout << "\n"; } }