5 Replies - 909 Views - Last Post: 22 November 2011 - 07:49 AM Rate Topic: -----

#1 Mylly  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 21-November 11

Navajo Code WWII c++

Posted 21 November 2011 - 08:01 PM

Hello!

I'm new here and pretty much new to programming too. I've been thinking of a program to encode messages with the Navajo code dictionary used during WWII.
The problem is that I don't know what operator to use to replace the letters with words or how to set up the array to encode the whole message a single letter at a time.
I could really use som pointers on how to set this function up.

Here's a link to Navajo Code, by the way:Navajo Code WWII
It's quite interesting stuff.


Thanks!, Richard

Is This A Good Question/Topic? 0
  • +

Replies To: Navajo Code WWII c++

#2 Adak  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 331
  • View blog
  • Posts: 1,168
  • Joined: 01-April 11

Re: Navajo Code WWII c++

Posted 21 November 2011 - 10:10 PM

You can't do it because you haven't studied the way the Navajo speakers did it, thoroughly enough. You don't just have to know how it was done, you have to KNOW EVERY TINY STEP that was used - especially the overall patterns. Those usually only emerge into our minds after numerous times of seeing how it's done, nice and slow.

Get the pattern that's used, and write it down in little steps. THAT's the logic backbone your program could follow, also. After you get it down to English steps, change it into pseudo code, and finally into C.

Some problems are so simple we don't need to do all this, but things that are more difficult or foreign, we have to take these preliminary steps so we can first understand just WHAT THE HELL is going on.

THEN we can get to the coding part of it.

If you could narrow down your question, we could probably help out, but I doubt if anyone here is a "Wind Talker", or knows how it was done.
Was This Post Helpful? 0
  • +
  • -

#3 Mylly  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 21-November 11

Re: Navajo Code WWII c++

Posted 22 November 2011 - 06:39 AM

I think you missunderstood my intensions. I'm not trying to add every word in the navajo dictionary but just the code words for the alphabet they used. Pretty much the top part of the website I linked.
So if the input is "D.I.C" the output would be "CHINDI.YEH-HES.BA-GOSHI" for example.
I realise that it's not very practical, but it would be a fun thing to do.
The problem is that I don't know how to write a function that translates each letter to the code word corresponding to that letter. I hope that explains my idea a little better.

Best Regards, Richard
Was This Post Helpful? 0
  • +
  • -

#4 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6110
  • View blog
  • Posts: 23,667
  • Joined: 23-August 08

Re: Navajo Code WWII c++

Posted 22 November 2011 - 06:44 AM

With C++ and multiple letter-to-code mappings, a multimap would be my container of choice. Assuming the different mappings for each letter are non-specific, you could randomly select a code word for each letter at run time.
Was This Post Helpful? 0
  • +
  • -

#5 Adak  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 331
  • View blog
  • Posts: 1,168
  • Joined: 01-April 11

Re: Navajo Code WWII c++

Posted 22 November 2011 - 07:31 AM

Easy smeazy:

Declare a 2D char array (rows and columns). The rows will be your 26 words in Navajo, that correspond to your letters.

So char letters[128] would cover all the letters, both upper and lowercase (you could make this smaller (all the way down to 26 elements, if you wanted).

Using the ASCII character set values:

letters[A]={"Navajo word for letter A"};
letters[B]={"Navajo word letter B"};

etc.

Then just run though each letter in the message you wanted to make:

for(i=0;i<strlen(message);i++) {
  strcat(myNavajocharArray, letters[message[i]];
}

myNavajocharArray[i+1] = ' '; //space between words

I'd have to test it for accuracy, but that's the idea.
Was This Post Helpful? 0
  • +
  • -

#6 Mylly  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 21-November 11

Re: Navajo Code WWII c++

Posted 22 November 2011 - 07:49 AM

Thank you all for your advice. I'll have to do some studying and testing since I'm quite new at programming, but this should get me off to a good start. I'll post some code for you when I get somewhere, or run in to som problems.

Thanks again!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1