Level 8 - Files and exceptions 0 of 9 activities solved
  1. Saving data Not yet solved
  2. School club Not yet solved
  3. Shopping list Not yet solved
  4. Attributes Not yet solved
  5. Cookies Not yet solved
  6. Morse code Not yet solved
  7. ini file Not yet solved
  8. Amino acids Not yet solved
  9. Gamertag Not yet solved
Next series Level 9 - Two-dimension arrays and lists
Level 8 - Files and exceptions

Morse code

Sign in to hand in your solution and get feedback.

// Morse code program using System; using System.IO; class Submission { // ------------------------- // Subprograms // ------------------------- static string translate(string morse) { switch (morse) { case ".-": return "A"; case "-...": return "B"; case "-.-.": return "C"; case "-..": return "D"; case ".": return "E"; case "..-.": return "F"; case "--.": return "G"; case "....": return "H"; case "..": return "I"; case ".---": return "J"; case "-.-": return "K"; case ".-..": return "L"; case "--": return "M"; case "-.": return "N"; case "---": return "O"; case ".--.": return "P"; case "--.-": return "Q"; case ".-.": return "R"; case "...": return "S"; case "-": return "T"; case "..-": return "U"; case "...-": return "V"; case ".--": return "W"; case "-..-": return "X"; case "-.--": return "Y"; case "--..": return "Z"; default: return " "; } } static string read_morse(string filename) { } // ------------------------- // Main program // ------------------------- public static void Main(string[] args) { string message = read_morse("message.txt"); Console.WriteLine(message); } }