Hi,
So I've been trying to get through this task for awhile now, for my college work, and there's something that I'm not getting. Here is the task:
When I try to run it, I usually get greeted by an encrypted message that is far longer than my starting message. Technically, I can move on from this task, but it's annoying me.
thanks
So I've been trying to get through this task for awhile now, for my college work, and there's something that I'm not getting. Here is the task:
Now here is my attempt, please forgive how ugly it looks, but it is the result of a lot of changing and testing:Write a program that declares an array of characters with six rows and six columns and fills it with ?space? characters.
It should then input a message, place it letter by letter into the array by rows, then output the result of reading it column by column.
When testing your program try to use messages that are close to the maximum length or your encrypted version will contain many blanks.
When copying down the encrypted version, count the spaces carefully.
Module Module1 Sub Main() Dim Message(5, 5) As String Dim number1 As Integer Dim number As Integer Dim StringLine, EncryptedString As String For Index2 = 0 To 5 For Index = 0 To 5 Message(Index, Index2) = "" Next Index Next Index2 Console.Write("Insert a message <up to 36 characters>: ") StringLine = Console.ReadLine Dim Testnum As Integer Testnum = 36 - StringLine.Length If Testnum > 0 Then For num = 0 To Testnum StringLine = StringLine + (" ") Next num End If number = -1 For Index2 = 0 To 5 number = number + 1 For Index = 0 To 5 number1 = number Message(Index2, Index) = StringLine.Substring(number1) number1 = number1 + 1 Next Index number = number1 Next Index2 EncryptedString = "" For Index2 = 0 To 5 For Index = 0 To 5 EncryptedString = EncryptedString + Message(Index, Index2) Next Index Next Index2 Console.WriteLine(EncryptedString) Console.ReadLine() End Sub End Module
When I try to run it, I usually get greeted by an encrypted message that is far longer than my starting message. Technically, I can move on from this task, but it's annoying me.
thanks
Last edited by a moderator: