Case Study:

You are asked to write a Morse encoder/decoder program. The program should have a menu to present the options:

Encoding Scheme: How do you begin such a program? There are many ways to break it up. Let’s step through the development process.

  1. For our first step, lets create a program that reads in a line from the keyboard and encodes it.
    See: morseCode1.c
  2. Once this works, we can move the encoding code in to a function.
    See: morseCode2.c
  3. Once this works, we can move on and add to our program Now let’s add the decoding ability.
    See: morseCode3.c
  4. Ok, we can encode and decode. Now lets get our program to loop, prompting the user for the next command. We’ll also implement the printMenu since that’s pretty easy (printf statements). Notice that we put stubs in our switch for encoding/decoding a file, and merely print out that this function isn’t implemented yet.
    See: morseCode4.c
  5. All right, we’re almost done. Now we need to add the file functions. Here’s the final version.
    See: morseCode5.c