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

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




PostPosted: Mon Mar 24, 2003 10:31 pm   Post subject: need help please

k. i haf this program that requires me to draw a diamond wit "*".
for example,
if user enters 3, i should print:
___*
__***
_*****
__***
___*

if 4, then:
____*
___***
__*****
_*******
__*****
___***
____*

***Scratch out underscores***

i started wit a flowchart that was too complicated - i'll try putting my flowchart up:

input: size
process: star = 1
process: starcount = 1
process: size = size * 2 -1

loop
process: count = 1
process: space = (size - count) div 2

loop
output: " "..
decision: exit when count = space
process: count := count +1
end loop

count :=1

loop
put "*"..
exit when starcount = star
starcount := starcount +1
end loop

star := star +2

loop
put " "..
exit when count = space
count := count + 1
end loop

put " "
exit when star = size
end loop



*** i tried doin' this by splitting it into sections, this is the top half but i dunno how to connect and i'm not sure if the above works.

please reply.
thanks.
Sponsor
Sponsor
Sponsor
sponsor
Asok




PostPosted: Mon Mar 24, 2003 11:29 pm   Post subject: (No subject)

This question has been answered allready in another thread:
http://www.compsci.ca/bbs/viewtopic.php?t=302&postdays=0&postorder=asc&start=30

check near the bottom of page 3
Tony




PostPosted: Tue Mar 25, 2003 12:23 am   Post subject: (No subject)

it would help soo much if people actually used helpful titles for their new posts rether then !!!!HELP ME NOW!!!!!!!!!!!! since in case like that, not only do we NOT know what its about... even if we do answer the questions, others looking will probably just skip it and ask same question again Sad
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
azndragon




PostPosted: Tue Mar 25, 2003 7:07 am   Post subject: (No subject)

You can't really blame him, it's so far down, I wouldn't think to look at it either Very Happy
justlam_




PostPosted: Tue Mar 25, 2003 11:06 am   Post subject: sorry for not writing a smart topic name

i've checked the first 2 pages for related problem and can't find any yet. the link isn't the same program nor is it related but thanks anyways.
Tony




PostPosted: Tue Mar 25, 2003 11:50 am   Post subject: (No subject)

no, its the same problem... scroll down to the very bottom
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Asok




PostPosted: Tue Mar 25, 2003 5:58 pm   Post subject: Re: sorry for not writing a smart topic name

justlam_ wrote:
i've checked the first 2 pages for related problem and can't find any yet. the link isn't the same program nor is it related but thanks anyways.


I SAID BOTTOM OF PAGE THREE!!! Evil or Very Mad
MysticAngel




PostPosted: Tue Mar 25, 2003 6:50 pm   Post subject: (No subject)

hi. i did the same thing. here is thepeice of code that might help u


loop
put ""
put "Please enter the size"
get size
put ""
exit when size < 21 and size > 1
end loop
for decreasing i : size .. 0 by 1
for i2 : 0 .. i
put " " ..
end for
for i3 : 1 .. size - i * 2
put "*" ..
end for
put ""
end for
for i : 1 .. size
for i2 : 0 .. i
put " " ..
end for
for i3 : 1 .. size - i * 2
put "*" ..
end for
put ""
end for

MOD Edit: Thx for sharing your code with us Smile I'll give you some bits
Sponsor
Sponsor
Sponsor
sponsor
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  [ 8 Posts ]
Jump to:   


Style:  
Search: