Word pyramid help
Author |
Message |
noteric
|
Posted: Tue Oct 02, 2007 10:37 am Post subject: Word pyramid help |
|
|
we are trying to make a word pyramid for our grade 10 turing class. Using this code:
var len : int
var word : string
var len2 : int
put "Enter a word : " ..
get word:*
len := length (word)
for i : 1 .. len
len2 := (80 - i)div 2
put "" : len2, word (1 .. i)
end for
we end up with something that is to the effect of :
pittspecials.com/~ericb/pyramid.bmp
We have concluded that is is like that because we can't put spaces in between the characters.
So I am asking for help, on inserting spaces in between every character.
Any help whatsoever is appreciated |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Tony
|
Posted: Tue Oct 02, 2007 10:56 am Post subject: RE:Word pyramid help |
|
|
From your code I can see that you're already familiar with for loops, and substrings. You should be able to loop through every character in a word, and insert a space in between. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
|
|