Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Word pyramid help
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
noteric




PostPosted: 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
Sponsor
sponsor
Tony




PostPosted: 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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: