// File: ArrayAsk.cpp // Find the extremes in a list of maximum 10 integers. // The list is stored in an array that can hold from 0 to 10 elements. // Data is input interactively using an ask before iterating loop #include using namespace std; int const MAXITEMS=10; void GetData(int List[],int &Count); void FindExtremes(int Values[],int Items,int &Min,int &Max); void Report(int Values[],int Items,int Min,int Max); int main() {int List[MAXITEMS],Items,Min,Max; GetData(List,Items); if (Items) { FindExtremes(List,Items,Min,Max); Report(List,Items,Min,Max); } return(0); } // Read up to MAXITEMS integers into the first formal argument, // returning the number of items read. // Stop reading when either the user says to or when MAXITEMS integers are read // Q: Why isn't List prefaced with &, given it is an output argument??? void GetData(int List[],int &Count) {Count=0; cout << "Enter Positive Integers. Enter -999 to Quit >"; cin >> List[Count++]; // GetAnswer is the Second Condition. What is the problem if it is first?? while ( Count < MAXITEMS && List[Count-1]>0) { cout << "Enter Next Positive Integer; -99 Quits >"; cin >> List[Count++]; } if (CountMax) Max=Values[Index]; else if (Values[Index]