Computer Science Canada Help me make a program |
Author: | laci211 [ Thu Nov 22, 2007 1:23 pm ] |
Post subject: | Help me make a program |
This is what i need to do and i have no clue how to do it Use loops and pixel graphics to write a program that will do the following: ❏ ask the user for a number n between 3 and 10 ❏ execute a loop n times ❏ this loop will create a square in the middle of the screen that is 200 pixels wide ❏ then it will create a square in the centre of the original square that is 180 pixels wide ❏ this will go on for decreasing squares, of different colours until there are n squares within each other, each square is 20 pixels less than the previous. I need your help Thanks |
Author: | Zampano [ Thu Nov 22, 2007 1:50 pm ] |
Post subject: | Re: Help me make a program |
There's little way we can help without telling you an answer. Just get the number, execute a forloop from 1 to the number. A rand.int must be used for the outline. Also have a counter that goes down ten each time the forloop happens. This is for the square. Just use drawbox(maxx/2-the decreasing counter,maxy/2-counter,maxx/2+the counter,maxy/2+counter,rand.int) Then you're set. |