#include #include #include // has EXIT_SUCCESS int main() { string inputName, nameOfOldest; int inputAge; int ageOfOldest = -1; // signals no value yet // each input line looks like: // while (cin >> inputName >> inputAge) { if (inputAge > ageOfOldest) { nameOfOldest = inputName; ageOfOldest = inputAge; } } // No more input when we reach here. cout << "The oldest person " << nameOfOldest << " is " << ageOfOldest << " years old.\n"; return EXIT_SUCCESS; }