// File: ForLoopBoolFlagForceNNValues.CPP // N Values; N Forced in a Loop; 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 // Error Check: If ValuesToprocess is non-positive, require the // user to re-enter. Iterate until positive value is entered. #include #define False 0 #define True 1 using namespace std; int main() {int Count,Value,Min,Max,ValuesToProcess,ExtremesInit=False; // Force the user to enter appropriate data // The loop will not terminate until ValuesToProcess is Positive do { cout << "How Many Values to Process? >"; cin >> ValuesToProcess; } while (ValuesToProcess<=0); // The three elements of a counted loop are in one statement for (Count=1;Count<=ValuesToProcess;Count++) { if (!ExtremesInit) cout << "Enter the 1st Integer>"; else cout << "Enter the Next Integer>"; 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