3 NATO output

 

Count yourself blessed if you’ve never had to spell your name over the phone. Or perhaps you’re named Mary Smith, but you live on a street or in a city you must constantly spell aloud. If so, you resort to your own spelling alphabet, something like, “N, as in Nancy” or “K, as in knife.” As a programmer, you can ease this frustration by reading this chapter, where you

  • Understand the NATO phonetic alphabet and why they even bother.
  • Translate words into the spelling alphabet.
  • Read a file to translate words into the phonetic alphabet.
  • Go backward and translate the NATO alphabet into words.
  • Read a file to translate the NATO alphabet.
  • Learn that natto in Japanese is a delicious, fermented soybean paste.

The last bullet point isn’t covered in this chapter. I just enjoy eating natto, and now I can write it off as a business expense.

Anyway.

The glorious conclusion to all this mayhem is to not only learn some new programming tricks but also proudly spell words aloud by saying “November” instead of “Nancy.”

3.1 The NATO alphabet

Beyond being a handy nickname for anyone named Nathaniel, NATO stands for the North Atlantic Treaty Organization. It’s a group of countries who are members of a mutual defense pact.

Established after World War II, blah-blah-blah. I could wax on, but the point is that NATO requires some commonality between its member states. You know, so that when Hans is short on ammo, Pierre can offer him bullets and they fit into the gun. Stuff like that.

3.2 The NATO translator program

3.2.1 Writing the NATO translator

3.2.2 Reading and converting a file

3.3 From NATO to English

3.3.1 Converting NATO input to character output

3.3.2 Reading NATO input from a file