Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Marketing The Ultimate Marketing Tool

Authors: Edward L. Nash

1st Edition

0070460639, 978-0070460638

More Books

Students also viewed these Databases questions

Question

Advance warning and an explanation for the layoff.

Answered: 1 week ago

Question

How many Tables Will Base HCMSs typically have? Why?

Answered: 1 week ago

Question

What is the process of normalization?

Answered: 1 week ago