Question
Using Loops, Design a program that checks whether a string is a palindrome. The string can be several words or just a single word: Acme
Using Loops, Design a program that checks whether a string is a palindrome.
The string can be several words or just a single word:
Acme Palindrome Finder Enter a string to check: Was it a rat I saw?
Analyzing input. Please wait Your input: Was it a rat I saw Reverse input: was I tar a ti saW
Congratulations! Palindrome found!
Minimum Requirements: Your program should pick a random number from 3 to 7 and wait that many seconds before displaying the results. Use functions from the time.h library to get the current time. Use a loop to query the system clock until the desired number of seconds have passed. NOTE:You can use the wait() function code shown in class, or you can use a delay function of your choice. The input should not be case sensitive. The program should work with numbers as well as letters. White space is not part of a palindrome, as you can see in the above example. Your algorithm should remove white space to check for a palindrome, but the final display should simply reverse the original string (keeping the white space intact).
BONUS (5pts): Instead of simply printing the reverse of the input string, make your display routine print the reversed string with spaces in the same locations as the input string. Using the original example, the output would look like this instead: Your input: Was it a rat I saw Reverse input: was It a rat i saW
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started