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

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




PostPosted: Tue Nov 12, 2002 4:32 pm   Post subject: Need ur help

Write a program to fill execution window with diagonal lines of
Asterisks separated by diagonal blank lines.(note that this can be
Accomplished easily by outputting lines of alternating asterisks and
Blanks using, in turn , either

Put repeat("*",40)
Sponsor
Sponsor
Sponsor
sponsor
FizixMan




PostPosted: Tue Nov 12, 2002 7:23 pm   Post subject: (No subject)

If you wanted:
* * * * * *
.* * * * * *
* * * * * *
.* * * * * *
* * * * * *
.* * * * * *
* * * * * *
.* * * * * *
(btw, I put the period in 'cause the web browser didn't register the space in front of the even lines. So think of the period as a space.)

then this code will work.

code:

for count : 1 .. maxrow
    if count mod 2 = 0 then
        put repeat (" *", round (40))..
    else
        put repeat ("* ", round (39))..
        put "*"
    end if
end for


I use the "mod" thing to get the remainder of "count" so I can alternate between putting " *" and " *" on the rows. Because if the row is odd, I'll get a remainder of 1 and if the row is even then I'll get 0. I had to add the extra "*" on the odd rows 'cause there was still space for one to fit an asterix but not the extra space. That's also why it repeats only 39 times.[/code]
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: