How do i make a translator?

Mac Osxtopus

Registered
I was making a stupid little language that switches around the letters of the alphabet to make a new language. I already have the part of the program that lists the entire alphabet as a list, left side is normal, right side is new. I dont know how to make a new part of the function in where the user inputs words and such, and the word's letters are changed into what they are for the new language. Any c++ proggers got any help for me? (give examples, please)
 
Its hard to give any specific examples with so little information... what do you mean by list? An array? a linked list? Do you have two arrays... one for each alphabet or how is it organized? Is it one two-dimensional array?

For the actual conversion part of it
I would create a new function such as this...

String* convertWordToNewLanguage(String originalWord)
{
// now follow these steps...

-make a String variable called newWord or something similar
-get the first letter in originalWord
-look it up in your list (whatever it is)
-get the letter in your new language that corresponds to the letter in your old language
-add that new letter to your newWord

-repeat until you have done this for each letter in originalWord and you end up with your newWord

-then return newWord
}

I don't know what environment you are in...
So if you want more than this description you need to tell me more... are you using straight C++? What do you want to use for input? Just the console or did you want a user interface?
A console program would be easier for something like this.

I was not sure what exactly you wanted to know.
I would try asking one very specific question at a time.. and I will gladly explain it to you. Its easier that way.

You could also try sending me your source code.
 
Back
Top