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

Username:   Password: 
 RegisterRegister   
 how can i draw horizontal circles?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
trish




PostPosted: Thu Sep 23, 2004 6:40 pm   Post subject: how can i draw horizontal circles?

okay sorry about my other post and also about watever discomfort it caused 2 a memeber...well since u myt all think that i just decided to make u do my homework i'm not so here's wat i've been doing...
setscreen ("graphics:640;480")
var x, sides : int

sides := 30
x := 40

for i : 1 .. 8
drawoval (x, 200, sides, sides, 2)

x += 1

exit when x > 60

end for

so can anyone tell me how i can make a horizontal line of circle or please tell me wat i'm doing wrong in this program
Sponsor
Sponsor
Sponsor
sponsor
AsianSensation




PostPosted: Thu Sep 23, 2004 6:45 pm   Post subject: (No subject)

well, there are bunch of stuff here that needs fixed.

First, there shouldn't be an exit statement in a for loop unless you want early termination.

Second, you are increasing the x coordinate by 1 each time. The 1 stands for 1 pixel length. But you want the circles to be drawn side by side. So instead of increasing by 1, you should increase by the diameter of the circle.

so your finishing code would look something like this:
code:
setscreen ("graphics:640;480")
var x, sides : int

sides := 30
x := 40

for i : 1 .. 8
drawoval (x, 200, sides, sides, 2)

x += sides * 2

end for
trish




PostPosted: Thu Sep 23, 2004 6:56 pm   Post subject: (No subject)

thanks but can i ask wat the 2 was for?
Andy




PostPosted: Thu Sep 23, 2004 7:12 pm   Post subject: (No subject)

so u leave enuff space for the nxt circle... since ur circle has a radius of "sides", you have to leave twice that much so the circles dont overlap
Dan




PostPosted: Fri Sep 24, 2004 5:41 pm   Post subject: (No subject)

Grrr, you should have not made a 2nd topic for this when it is realy the same question but rather just replyed to the 1st one. One good way of finding out the rules and what is acpeteable to poleop on a froum is to look at the rules post (in GD) and the how do i ask a question, the so you are looking for help and the rules posts in this section as well.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
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  [ 5 Posts ]
Jump to:   


Style:  
Search: