// // Filename: pgm3_2b.cpp // // Description: Demonstration of User defined functions #2 // // ENSC 104: Digital Computer Programming // // Instructor: Dr. Walsh // // Section: 2 // // Date Created: 03/01/98 // Last Modified: 03/01/98 // // Name: N/A // // ***** Interface files ***** #include // ***** Function Prototypes ***** int maximum( int, int, int ); int minimum( int, int, int ); main() { int a, b, c; int max; int min; cout << "Enter three integers: "; cin >> a; cin >> b; cin >> c; cout << "You entered the following:\n" << " a = " << a << endl << " b = " << b << endl << " c = " << c << endl << endl; max = maximum( a, b, c ); min = minimum( a, b, c ); cout << "The maximum value is " << max << endl; cout << "The minimum value is " << min << endl; return 0; } int maximum( int x, int y, int z ) { int result; result = x; if ( y > result ) { result = y; } if ( z > result ) { result = z; } return result; } int minimum( int x, int y, int z ) { int result; result = x; if ( y < result ) { result = y; } if ( z < result ) { result = z; } return result; }