// File: WhileBoolFlagNoErrorSentinel.cpp // Sentinel Terminated; ; Boolean Flag; While 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 // Note that Data is always input directly before the sentinel is checked. #include #define False 0 #define True 1 #define Sentinel -999 using namespace std; int main() {int Value,Min,Max,ExtremesInit=False; // Prompt For First Value cout << "Enter the 1st Integer. " << Sentinel << " Quits >"; // Read first Value Before Loop cin >> Value; while (Value != Sentinel) { if (!ExtremesInit) { // Only Correct Method of Initializing Min and Max: // Set equal to initial Value Max=Min=Value; ExtremesInit=True; ; } else if (Value>Max) Max=Value; else if (Value"; cin >> Value; } if (ExtremesInit) cout << "Minimum:" << Min << "\tMaximum:" << Max << endl; return(0); }