Question: Lab Practice 6 : Functions Write a program that prints a menu ( use a void function for it ) with the following options: 1

Lab Practice 6: Functions
Write a program that prints a menu (use a void function for it) with the following options:
1. Palindromes. A palindrome is a string that is spelled the same way forward and backward. Examples of palindromes include "radar", "bob", "racecar". Write a Boolean function called testPalindrome that returns true if the user inputted word is palindrome, and false otherwise. Note that like an array, the square brackets ([]) operator can be used to iterate through the characters in a string.
2. Guess-the-number Game. Write a function that plays "guess the number" game as follows: Your program randomly generates an integer from 1 to 1000. The program displays the following:
Please guess a number between \(1-1000\) :
The player then types a first guess. The program responds with one of the following:
- Excellent! It took you X tries to guess correctly.
- Out of range. Try again.
- Too Low. Try again.
- Too high. Try again.
If the player's guess is incorrect, your program should loop until the player finally guesses correctly. The ranges your program prints will automatically close in as to exclude incorrect guesses. For example, say you guess 365, then 804, your program will print:
Please guess a number between \(365-804\) :
This is to help the player narrow in on the correct number. If the player inputs a number out of range, then the ranges will not update.
These are example of the lab output
Welcome user!
Please select from the following:
[a] Palindrome checker.
[b] Guess-the-number Game.
[c] Exit.
Choice: a
Enter a word to test: radar
radar is a palindrome.
Please select from the following:
[a] Palindrome checker.
[b] Guess-the-number Game.
[c] Exit.
Choice: a
Enter a word to test: snter a word to test: richard_nixon
richard_nixon is NOT a palindrome.
Please select from the following:
[a] Palindrome checker.
[b] Guess-the-number Game. Please select from the following:
[a] Palindrome checker.
[b] Guess-the-number Game.
[c] Exit.
Choice: b
Plese guess a number between 1-1000: 500
Too Low. Try again.
Plese guess a number between 500-1000: 750
Too Low. Try again.
Plese guess a number between 750-1000: 233
Out of range. Are you even trying?
Plese guess a number between 750-1000: 900
Too Low. Try again.
Plese guess a number between 900-1000: 950
Too high. Try again. 80//cout rNum "
"; //Prints random number generated for testi.
Plese guess a number between 900-925: 912
Too high. Try again.
Plese guess a number between 900-912: 906
Too high. Try again.
Plese guess a number between 900-906: 903
Too Low. Try again.
Plese guess a number between 903-906: 904
Too Low. Try again.
Plese guess a number between 904-906: 905
CongLatuRations!
You're Winner!
Lab Practice 6 : Functions Write a program that

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!