Programa que convierte texto a codigo morse

Solo disponible en BuenasTareas
  • Páginas : 2 (268 palabras )
  • Descarga(s) : 0
  • Publicado : 9 de mayo de 2011
Leer documento completo
Vista previa del texto
Imports System.Console
Module Module1
Sub Main()
Dim texto As String

'menu()
WriteLine("Ingrese el texto a convertir: ")
texto = ReadLine()Writeline("Texto original: " & texto)
writeline("La conversión es: " & conversionMorse(texto.tolower))
readline()
End Sub

Function conversionMorse(ByVal palabra AsString) As String
Dim codmorse() As String = {"· —", " — · · ·", "— · — ·", "— — — —", "— · ·", "·", "· · — ·", "— — ·", "· · · ·", "· ·", "· — — — ", "— · —", "· — · ·", " — —", " — ·", " — — ·— —", "— — —", "· — — ·", "— — · —", "· — ·", "· · ·", "—", "· · —", "· · · —", "· — —", "— · · —", "— · — —", "— — · ·"}
Dim acum As String = Nothing
Dim letra As StringFor cont As Integer = 0 To palabra.Length - 1
letra = palabra.substring(cont, 1)
Select Case letra

Case "a"
acum = acum +codmorse(0)
Case "b"
acum = acum + codmorse(1)
Case "c"
acum = acum + codmorse(2)
Case "ch"acum = acum + codmorse(3)
Case "d"
acum = acum + codmorse(4)
Case "e"
acum = acum + codmorse(5)
Case "f"acum = acum + codmorse(6)
Case "g"
acum = acum + codmorse(7)
Case "h"
acum = acum + codmorse(8)Case "i"
acum = acum + codmorse(9)
Case "j"
acum = acum + codmorse(10)
Case "k"
acum = acum+ codmorse(11)
Case "l"
acum = acum + codmorse(12)
Case "m"
acum = acum + codmorse(13)
Case "n"...
tracking img