Ask your own question, for FREE!
Mathematics 19 Online
OpenStudy (calculusxy):

Need help with drawing the Olympic Logo with C

OpenStudy (calculusxy):

The Olympic logo shown below consists of 5 colored rings. Mimic this logo by drawing circles with the turtle library. You can lift the pen up and down using turtle pen up and turtle pen down. To change the turtle’s pen color, use turtle set pen color. Turtle set pen color(0, 255, 0) makes the pen color entirely green, turtle set pen color(0, 0, 0) makes it black, and turtle set pen color(150, 123, 182 makes it lavender.

OpenStudy (calculusxy):

OpenStudy (phi):

does the library have a draw circle routine ?

OpenStudy (calculusxy):

we tried to draw using the while loop

OpenStudy (calculusxy):

{ turtle_init(600,600); int angle = 0; while (angle < 360) { turtle_forward(1); turtle_turn_left(1); angle++; }

OpenStudy (phi):

ok. Have you learned how to write subroutines (or functions) ? because you have to use that a few times.

OpenStudy (calculusxy):

Nope

OpenStudy (calculusxy):

Well what do you mean by "subroutines (or functions)"?

OpenStudy (phi):

for example forward(200) is a function (that is in the library) if would be convenient if we had a circle(radius, centerx, centery) that drew a circle

OpenStudy (calculusxy):

I did not learn that :(

OpenStudy (calculusxy):

Is there any other way to do this?

OpenStudy (phi):

btw, your circle code will make a very tiny circle. You will have to "debug" it ***Is there any other way to do this? *** yes, you copy and paste the circle code (once for each circle) but will different "start position", and line color the program will get long, but it will work.

OpenStudy (calculusxy):

OK I think I am ready

OpenStudy (phi):

what is your code for a circle? Have you tested it ?

OpenStudy (calculusxy):

Do you mean this: { turtle_init(600,600); int angle = 0; while (angle < 360) { turtle_forward(1); turtle_turn_left(1); angle++; }

OpenStudy (calculusxy):

If yes, then I have tested this.

OpenStudy (phi):

how big is the circle ?

OpenStudy (calculusxy):

The Olympic circle?

OpenStudy (phi):

when you run your circle program, it draws a circle. How big is it? we have to fit 3 across on the screen

OpenStudy (calculusxy):

It's something like this:

OpenStudy (phi):

ok. can you draw a circle on each side of it ? (by changing the start position, and keeping the code the same) maybe we can do it in a loop ?

OpenStudy (calculusxy):

I have only learned while loop.

OpenStudy (calculusxy):

And the if-then executions

OpenStudy (phi):

you can make it count by doing: ct=0 while ( ct++ < 3) { do stuff }

OpenStudy (calculusxy):

I don't understand the command @phi

OpenStudy (phi):

you want to draw more than 1 circle you could do something like x= 200; y= 600; ct= 0; while (ct++ < 3) { turtle_init(x,y); do the circle stuff x+= 130; (this is a guess) }

OpenStudy (calculusxy):

What does the x represent?

OpenStudy (phi):

the start position for the circle. If you want different circles, we have to change it each time "through the loop"

OpenStudy (calculusxy):

And the y?

OpenStudy (phi):

you have turtle_init(600,600) we want to be a able to change that (all the circles have to start at different places) so I was thinking ahead... we will also want to change the y values for the bottom 2 circles

OpenStudy (calculusxy):

ok

OpenStudy (phi):

try something.it might make more sense if you experiment.

OpenStudy (calculusxy):

i am testing it out right now

OpenStudy (calculusxy):

Is it going to be something like this: #include "turtle.h" { int x=200; int y=600; int ct=0; while(ct++ <3) { turtle_init(600,600) int angle = 0; while (angle < 360) { turtle_forward(1); turtle_turn_left(1); angle++; }

OpenStudy (phi):

I don't know what turtle_init does, but I'm thinking it erases everything on the screen and then "puts" the pen at the position you tell it. so we can't use it to move to the next circle. maybe we have to draw the circle lift the pen move to the new start position lower the pen does that make sense ?

OpenStudy (calculusxy):

turtle_init I think just sets the greatest and shortest amount of pixels on the screen

OpenStudy (phi):

it must also set the start position of the pen ?

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!