Imports Microsoft.VisualBasic
Console.WriteLine("Caesar Cipher Encoder/Decoder")
Console.WriteLine("Enter the text you want encoded / decoded: ")
PlainText = Console.ReadLine()
Console.WriteLine("Press 1 to encode or press 2 to decode: ")
Choice = Console.ReadLine()
Console.WriteLine("Enter a value between 1 and 25: ")
Offset = Console.ReadLine()
For n = 0 to PlainText.Length -1
Letter = PlainText.Chars(n)
If Ascii >= 65 And Ascii <= 90 then
If Ascii + Offset <= 90 then
Ascii = Ascii + Offset - 26
Else If Ascii >= 97 And Ascii <= 122 then
If Ascii + Offset <= 122 then
Ascii = Ascii + Offset - 26
CipherText = CipherText + Chr(Ascii)
For n = 0 to PlainText.Length -1
Letter = PlainText.Chars(n)
If Ascii >= 65 And Ascii <= 90 then
If Ascii - Offset >= 65 then
Ascii = Ascii - Offset + 26
Else If Ascii >= 97 And Ascii <= 122 then
If Ascii - Offset >= 97 then
Ascii = Ascii - Offset + 26
CipherText = CipherText + Chr(Ascii)
Console.Writeline(CipherText)