// FILE: Largest.cpp // FINDS THE LARGEST NUMBER IN A SEQUENCE OF INTEGER VALUES #include // needed for cin and cout #include // needed for INT_MIN int main () { // Local data ... int item_value; // each data value int largest_so_far; // largest value so far int min_value; // the smallest integer // Initialize largest_so_far to the smallest integer. min_value = INT_MIN; largest_so_far = min_value; // Save the largest number encountered so far. cout << "Finding the largest value in a sequence: " << endl; do { cout << "Enter an integer or " << min_value << " to stop: "; cin >> item_value; if (item_value > largest_so_far) largest_so_far = item_value; // save new largest number } while (item_value != min_value); cout << "The largest value entered was " << largest_so_far << endl; return 0; }