[6 / 1 / ?]

No.51020245 ViewReplyReportDelete
Module Module1
Sub Main()
Console.WriteLine("would you like to encode[e], decode[d], or exit?[esc]")
Console.ReadLine()
End Sub


Function encrypt() As String
Dim key As Integer
Dim message As String
Dim encmessage As String
Console.Write("please enter a message To be encrypted: ")
message = Console.ReadLine

Dim letterarray() As Char = message.ToCharArray
Console.Write("what key would you like to use?:")
key = Console.ReadLine()
For i = 0 To letterarray.Length - 1
encmessage = encmessage & Chr(Asc(letterarray) + key)
Next
Return encmessage
End Function

Function decrypt() As String
Console.WriteLine("Please enter message to be decrypted: ")
End Function

End Module


i have a few issues with this code so far:

first - how do i make the programme access the correct sub routine when I type either "e", "d" or "esc"

secondly - the encoding part, I'm using ascii as the basis for this but the problems with that are, when going past the letter "z" it doesn't cycle back to the letter "a",
it instead goes to "{"

thirdly - the programme only changes the first letter, the rest just mimic the first change, look at the photo for a better explanation of this