Computer problems,Computer help
*AX SOFT>>>Programming & Design

I need help to create a program to put a string backwards with an array and a function?


This is the format:

Write a program to fill an array with the following five words: radar, warts, evil, racecar, toot. Create a function to receive the array and print each of the words in reverse order. The word palindrome is from the Greek meaning to "run back again." Words that are palindromes will be spelled the same forward as they are backward. Have this function also determine whether any of these words are palindromes.

(Any information or help given is greatly appreciated)

Not sure what language, but in pseudo code....

I assume you have an array that contains Strings.

1) Loop through the array creating a temporary string variable for each word in your array. "tempString"

2) In your loop, create a String variable called "reversedString" and make it empty ""

3) Inside your loop, create another loop (inner loop) where you go from 0 to the size of your tempString.

4) inside this second loop, go backwards over the tempString, and append each letter to the reversedString. Something like this for(int = 0; int < tempString.size; int++)
<--(psuedocode) Then do something like tempString.charAt(tempString.size - int + 1) (in many languages, arrays start at 0, thus the +1)

This will have the affect of iterating over your tempString backwards

5) while iterating backwards over this tempString, append each letter to your reversedString... reversedString = reversedString + (currentLetter from above);

6) When the loop is done, print out the reversedString. If reversedString = tempString, then you know it's a palindrome.

Good luck.

Tags
  General - Computers & Internet   Software   Security   Programming & Design   Facebook   Flickr   Google   MSN   MySpace
Related information
  • Vista slow boot with black screen?

    mines does the same. nothing wrong with that at least it doesn't have some Major virus!

    ...
  • Is there a visual basic for Mac? Or something Similar?

    i like java. the syntax is similar to visual basic in most respects, and it works on all computers not just ms windows. eclipse is an awesome development platform for java and works great on os...

  • Setting up mysql on godaddy?

    no.. you do not need to download mysql. they have it installed for you. set your database up on their site.

    ...
  • Tell me this?

    I suggest joining the yahoo mailing list over here . ...

  • How can I tell if I have php gd installed with phpinfo on php 5.1.6?

    When installed it will show a section for GD with all the options and which ones are enabled / disabled. Perhaps you host has installed GD but forgot to recompile PHP with GD support.

    ...
  • How can I publish my website from Dreamweaver?

    I'm telling you that purchased templates are evil, a pain in the butt, and not worth the time. I'm not saying this from a designer standpoint but when I was working for a company they had...

  • How do you make flash games?

    Adobe flash professional, macromedia director.... Here is a site that has tutorials that might help you: ...

  • Can you have two or more files open for writing when doing C++ programming?

    Absolutely yes! Full Code(How I do it): #include <fstream.h> int main () { fstream file1; fstream file2; file1.open("file1.txt",ios::out); file2.open("file2.txt",i...

  •  

    Categories--Copyright/IP Policy--Contact Webmaster