
-----------------------------------
justlam_
Mon Mar 24, 2003 10:31 pm

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.

-----------------------------------
Asok
Mon Mar 24, 2003 11:29 pm


-----------------------------------
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
Tue Mar 25, 2003 12:23 am


-----------------------------------
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 :(

-----------------------------------
azndragon
Tue Mar 25, 2003 7:07 am


-----------------------------------
You can't really blame him, it's so far down, I wouldn't think to look at it either :D

-----------------------------------
justlam_
Tue Mar 25, 2003 11:06 am

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
Tue Mar 25, 2003 11:50 am


-----------------------------------
no, its the same problem... scroll down to the very bottom

-----------------------------------
Asok
Tue Mar 25, 2003 5:58 pm

Re: 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.

I SAID BOTTOM OF PAGE THREE!!!  :evil:

-----------------------------------
MysticAngel
Tue Mar 25, 2003 6:50 pm


-----------------------------------
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 :) I'll give you some bits
