/* Reads a list of 0 or more non-negative integers flagged by a negative. Outputs the count, sum, and average of the list. */ /* NOTE! The program is down a couple of pages...don't scroll down until you've run the program and attempted to guess at the error */ #include int main() { int num, count, sum; float average; cout << "Begin LapLoop5 ..." << endl << endl; sum = 0; count = 0; cout << "Enter the next number> "; cin >> num; while (num >= 0) { sum = sum + num; count++; cout << "Enter the next number> "; cin >> num; } cout << endl; average = float(sum)/float(count); // we need to cast at least one to real cout << " Size of list: " << count << endl << " Sum of list: " << sum << endl << "Average of list: " << average << endl; cout << endl << "End LabLoop5" << endl; return(0); }