An array to remember

Storing the history of values in a program is a common task. Maintaining an object's history requires the programmer to either write specific code or use a library which supports history logging. Today you're going to write specific code to store the history of a list.

Create a program that prompts for words and saves those words to a variable. The program remembers the history of the variable because the variable is an array. Next use a for loop to print the words to the console in order the user entered them. Print the history whenever the user types the word history, otherwise save the word that is entered.

Type in the names of the presidents in the order they were elected. When you are done enter the word history. Your program should display their names starting with the most recent.

For your convenience the names of the last ten presidents are:
Kennedy, Johnson, Nixon, Ford, Carter, Reagan, Bush, Clinton, Bush, Obama