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

Username:   Password: 
 RegisterRegister   
 drawfill arc
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
starlight




PostPosted: Sun Apr 24, 2005 9:07 pm   Post subject: drawfill arc

i don't understand why doesn't this command works:

code:

var p:int
p:=(1000 div 2000)*360
drawfillarc (maxx div 2,maxy div 2,15,15,0,p,black)


isnt' this same as this?
code:

drawfillarc (maxx div 2,maxy div 2,15,15,0,180,black)


why doesn't the first cod execute ?
Sponsor
Sponsor
Sponsor
sponsor
Delos




PostPosted: Sun Apr 24, 2005 9:16 pm   Post subject: (No subject)

code:

put p


Value returned is 0. You're using div. This does not return real numbers, only integers.
starlight




PostPosted: Sun Apr 24, 2005 9:22 pm   Post subject: (No subject)

but if i use

code:

var p:real
p:=(1000 /2000)*360
drawfillarc (maxx div 2,maxy div 2,15,15,0,p,black)


it says the assign value is wrong type. so it there anyway to make p an integer other than use the div function?
Bacchus




PostPosted: Sun Apr 24, 2005 9:25 pm   Post subject: (No subject)

round()
starlight




PostPosted: Sun Apr 24, 2005 9:30 pm   Post subject: (No subject)

actually i know the round function works but i don't think i can use it in my case because i am trying to make a pie graph. and if i use the round function it rounds 0.5 into one which is not what i want.

code:

var p:int
p:=round(1000 / 2000)*360

drawfillarc (maxx div 2,maxy div 2,15,15,0,p,black)


the 1000 in my program represent the number of times out of 2000 and times 360 degree. so i don't think the round function should be use in my program.
Bacchus




PostPosted: Sun Apr 24, 2005 9:35 pm   Post subject: (No subject)

well there also ur problem, by using div it round the number down, making it 0 then multiplying it by 360 which is 0. wat you need to do is find the angle in real then round it. try
code:
var p:int:=round((1000/2000)*360)
drawfillacr(blah)
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  [ 6 Posts ]
Jump to:   


Style:  
Search: