http://www.partyideasforyou.com/fun-with-words-palindromes/

solving C programming by using C prgm,not C++ or others C?
1) User is required to enter a sentence. You have to tell whether the sentence is a palindrome or not.
You need to ignore any white spaces or punctuations.
Example 1:
Please enter a sentence: Madam, I’m Adam!
Your sentence is a palindrome.
Example 2:
Please enter a sentence: Madam, I am Adam!
Your sentence is not a palindrome.
2) User is required to enter a sentence in English to be transformed to Pig-Latin form. To transform a word to Pig-Latin form, the first letter of the word beginning with a consonant is moved to the back, added with letters ay after the moved consonant. Words that begin with a vowel are simply appended with ay. You can assume the user will not key in any punctuations or uppercase letters.
Example 1:
Please enter a sentence: this is an english sentence
Pig-Latin form: histay isay anay englishay entencesay
Example 2:
Please enter a sentence: hope you have fun
Pig-Latin form: opehay ouyay avehay unfay
Please ans within 12hr
Probably too late to help.
1) You need two arrays of character. After collecting the phrase, you copy it into one array, leaving behind all the punctuation, any spaces, and reducing the whole to lower case by testing the ascii value. Then going from beginning to end, copy the characters to the second array end to beginning. Then set a flag and step through both arrays and compare characters. If all match – palindrome. Can also do same preliminary work, then compare first character (x=0) to last (len-x) and continue until reach middle, then stop – palindrome if all match.
2) put the sentence in an array of character, setting a space flag as if a space just encountered. to make interation in next step easier.
set pointer for beginning of sentence, continue until end of sentence.
if pointer not to space
– if space flag set (previous was space)
– - test character at pointer
– - – if vowel, copy to output, clear space flag.
– - – if not vowel, copy to hold variable, clear space flag
– [not space set]
– - copy character to output
if pointer is to space set flag,
if hold variable not nul, copy that, set to nul
copy ‘ay’ to second array, copy space, increment pointer.
continue until end of sentence.
print output array.
[could just print characters instead of move, but less functional as a module for reuse.]
[01/02] 01022010 Palindromes Are Fun!
|
|
Too Hot to Hoot (Paperback)
$6.6 Dozens of questions and riddles that have palindrome words and phrases as answers encourage youngsters to engage in thoughtful word play and provide laughter at the same time. Reissue. |
|
|
Go Hang a Salami! I'm a Lasagna Hog!
$7.89 Agee has put both his dry sense of humor and artistic talents to wonderful use in this book of word play. As if the clever palindromes (sentences reading the same both backwards and forwards) weren't enough, the accompanying artwork adds another d... |