Other Tree Traversals Using the following recursive algorithms, traverse the tree of Figure 9.17.
1. A Guessing Game You are on vacation at home and planning to enjoy your free time. Alas! your parents ask you to take care of your little sister, and she is a real pest. In order not to see your vacation time slowly wasted, you decide to have the computer entertain your little sister. To do this, you want to develop a simple game program that will pick randomly an integer number between 1 and 1,000. The program will ask your little sister to guess that number in a maximum of ten tries, and will produce an appropriate message when the end of the game is reached. Obviously, the program needs to be interactive. It will display a message at the start of the game and prompt your sister for a guess. Each time she makes a guess, it will have to indicate whether the guess was between the limits or was high or low, or detect that the guess was right. At the end of a game, the program will allow your little sister to decide to continue to play or to stop. The input format is simply that of an integer number, or a character for yes or no. The output formats are mostly messages.
Let’s play a guessing game. I pick a number between 0 and 1,000. You have to guess it. But you have only 10 tries to guess my number.
Congratulations! 999 is right. You lose! My number was 999. Do you want another game? (Y/N)
Make a guess: Wait a minute! My number is greater than 0! You wasted a guess! My number is 1,000 or less. Well … your number is too small. Sorry, but your number is too big.
The post indicate whether the guess was between the limits or was high or low, or detect that the guess was right. appeared first on Best Custom Essay Writing Services | EssayBureau.com.