Computer Science Canada

drawfill arc

Author:  starlight [ 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 ?

Author:  Delos [ Sun Apr 24, 2005 9:16 pm ]
Post subject: 

code:

put p


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

Author:  starlight [ Sun Apr 24, 2005 9:22 pm ]
Post 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?

Author:  Bacchus [ Sun Apr 24, 2005 9:25 pm ]
Post subject: 

round()

Author:  starlight [ Sun Apr 24, 2005 9:30 pm ]
Post 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.

Author:  Bacchus [ Sun Apr 24, 2005 9:35 pm ]
Post 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)


: