// File: ForLoopBoolFlagNoErrorSentinel.CPP // Sentinel Terminated; ; 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 #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 in Init Area...Read Subsequent Values in Update Area for (cin >> Value;Value != Sentinel; cin >> Value) { 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"; } if (ExtremesInit) cout << "Minimum:" << Min << "\tMaximum:" << Max << endl; return(0); }