Computer Science Canada Depth, Width... Box. |
Author: | MossyMossy [ Thu Oct 29, 2009 8:36 am ] | ||
Post subject: | Depth, Width... Box. | ||
Hey guys, I need help with a problem I made myself a code, it asks for the width and the depth of a box, then draws the top and bottom lines accordingly using the turing coloring scheme. now I need make the program to add the side lines to the box, to complete it. keeping the color scheme consistent to what it is, for the existing portion of the program. ----------------------------- | | | <- depth | | | ----------------------------- | ^ width here is my code.
Please help me. |
Author: | MossyMossy [ Thu Oct 29, 2009 10:51 am ] |
Post subject: | Re: Depth, Width... Box. |
GOT IT!! thanks tho ^,^ var depth : int var width : int put "Enter the width of the box (less than 60)" get width put "Enter the depth of the box (less than 20)" get depth cls const topRow := (25 - depth) div 2 const leftColumn := (80 - width) div 2 var colorNo : int locate (topRow, leftColumn) for count : 1 .. width randint (colorNo, 0, 15) color (colorNo) put "*" .. end for locate (topRow + depth - 1, leftColumn) for count : 1 .. width randint (colorNo, 0, 15) color (colorNo) put "*" .. end for const sideTop := topRow + 1 const sideBottom := topRow + depth - 2 for row : sideTop .. sideBottom randint (colorNo, 0, 15) color (colorNo) locate (row, leftColumn) put "*" .. end for const rightColumn := leftColumn + width - 1 for row : sideTop .. sideBottom randint (colorNo, 0, 15) color (colorNo) locate (row, rightColumn) put "*" .. end for |