// File: ForLoopBoolFlagFunctionsSentinel.CPP // Sentinel Terminated; Functions (with Output Args); Boolean Flag; For Loop // Find the Extremes in a List of integers // Use a boolean flag to facilitate all data input into the program loop // Method of Iteration: for loop // Functions employed. All argument types exemplified #include #define False 0 #define True 1 #define Sentinel -999 using namespace std; void Update(int,int &,int &); void Init(int,int &,int &); void Report(int,int,int); int main() {int Value,Min,Max,ExtremesInit=False; // Prompt For First Value cout << "Enter the 1st Integer. " << Sentinel << " Quits >"; cin >> Value; for ( ;Value != Sentinel; ) { // Could be: while(Value != Sentinel) if (!ExtremesInit) { Init(Value,Min,Max); ExtremesInit=True; } else Update(Value,Min,Max); cout << "Enter the Next Integer. " << Sentinel << " Quits >"; cin >> Value; } Report(Min,Max,ExtremesInit); return(0); } // Initialize the Extremes // Arguments: // InitialValue - Input Only // Min, Max - Output Only void Init(int InitialValue,int &Min,int &Max) {// Only Correct Method of Initializing Min and Max: // Set equal to initial Value Min=Max=InitialValue; } // Update the Extremes IF the Value is a New Extreme // Arguments: // Value - Input Only // LowestValue, HighestValue - Input/Output void Update(int Value,int &LowestValue,int &HighestValue) {if (Value>HighestValue) HighestValue=Value; else if (Value