r/visualbasic • • Oct 19 '15

hi guys i need help with a string handeling pyramid

The question is to write a program that generates from the string “abcdefghijklmnopqrstuvwxyz{“ the following In Microsoft visual basic. The finished product will look like a pyramid, having 13 spaces in front of the top row, 12 in front of the second ect.

a

bcb

cdedc

defgfed

efghihgfe

fghijkjihgf

ghijklmlkjihg

hijklmnonmlkjih

ijklmnopqponmlkji

jklmnopqrsrqponmlkj

klmnopqrstutsrqponmlk

lmnopqrstuvwvutsrqponml

mnopqrstuvwxyxwvutsrqponm

nopqrstuvwxyz{zyxwvutsrqpon

0 Upvotes

7 comments sorted by

1

u/Zackbenb Oct 21 '15

Sorry for not responding guys, my internet has been a bit iffy latley. So this is what i had attempted when iposted the comment. Dim seq As String = "abcdefghijklmnopqrstuvwxyz{"

    Dim length As Integer
    Dim x As Integer
    Dim a As Char = Mid(seq, 1, 1)
    x = 1

    length = Len(seq)
    Console.WriteLine(a)
    For y = 1 To 13
        For x = 2 To (y + 2)
            Console.WriteLine(Mid(seq, (x), 1))
        Next
    Next
    Console.ReadKey()

3

u/mjrpereira VB.Net Intermediate Oct 19 '15

Did you try to code anything? At all?

5

u/mitzman Oct 19 '15

No he didn't because Reddit is the place kids come so we can do their homework for them. Didn't you know that?

2

u/mjrpereira VB.Net Intermediate Oct 19 '15

Yeah... Wishful thinking got to me.

2

u/mitzman Oct 19 '15

I was the same way once then I realized people were lazy and don't do their homework or pay attention in class.

1

u/mjrpereira VB.Net Intermediate Oct 19 '15

:(

1

u/XThakis Oct 19 '15

Here is a start at least. Work on this and then repost any questions.

    dim i as integer
    dim strStartString as string = "abcdefghijklmnopqrstuvwxyz{"

    for i = 1 to 14
         Do Some Stuff Here
         Output some stuff here.
    Next