
-----------------------------------
jakey140
Thu Dec 14, 2006 9:43 pm

String Manipulation 2
-----------------------------------
Hi again guys... This is regarding the same topic from before... I'm trying to figure out a program that will output any name into a diamond like formation. If you look at the code you can see what I'm basically trying to get at, however there are a few minor mistakes that I could use some help on...

[/code]

%This program will accept any user name (min 3 char, max 12), then output a cool design fully centred using there name.

var name : string

get name

locate (13 - length (name), 41 - length (name) div 2)
put name

locate (11 + length (name), 41 - length (name) div 2)
put name

for y : 1 .. length (name)
    locate (12 - length (name) + y, 40 - length (name) div 2 - y)
    put name (y) ..

    locate (12 + length (name) - y, 40 - length (name) div 2 - y)
    put name (y) ..

    locate (13 - y, 38 + length (name) - y)
    put name (y) ..

    locate (9 + y, 38 + length (name) - y)
    put name (y) ..

end for
