Unformatted text preview: Write a loop that can detect whether this string is a palindrome. a. If it is a palindrome, set some Boolean value to true. If it is not, set it to false. (How can you write an algorithm to do this?). 3. Use this Boolean value to either a. Indicate the string was a palindrome, output the string, exit the program. b. Make the string a palindrome by concatenating the existing string with a REVERSE copy of the same string. For example, if you are presented with “ilove202”, create the string “ilove202202evoli”. The input string will be unformatted text with no white-space or punctuation marks. e.g. racecar or kayarednudepeepedunderayak. Hints: You will need to use loops for parts 2 and 3b. You will most likely rely on the string methods “at” and “length” and the concatenation symbol “+” to complete this lab. Turn in a printed copy of your source code....
View Full Document
- Spring '09