Fill using Drawline.
Author |
Message |
MossyMossy
|
Posted: Fri Nov 13, 2009 9:20 am Post subject: Fill using Drawline. |
|
|
Turing: |
var point1r, point1c : int
var point2r, point2c : int
var point3r, point3c : int
var point4r, point4c : int
put "please enter your first row and first coloumn"
get point1c
point1c: = point1c * 10
get point1r
point1r: = point1r * 10
put "please enter your second row and second coloumn"
get point2c
point2c: = point2c * 10
get point2r
point2r: = point2r * 10
put "please enter your third row and third coloumn"
get point3c
point3c: = point3c * 10
get point3r
point3r: = point3r * 10
put "please enter your fourth row and fourth coloumn"
get point4c
point4c: = point4c * 10
get point4r
point4r: = point4r * 10
cls
%%%%%%%%%
% x1,y1,x2,y2 %
% x3,y3,x4,y4 %
% x4,y4,x1,x1 %
% x2,y2,x3,y3 %
%%%%%%%%%
drawline(point1c,point1r,point2c,point2r, 5)
drawline(point2c,point2r,point3c,point3r, 5)
drawline(point3c,point3r,point4c,point4r, 5)
drawline(point4c,point4r,point1c,point1r, 5)
%%%%%%%%%%%%
% This is the problem i am having. Cannot get the row's to loop so it fills in with draw lines.
loop
point1c: = point1c + 1
drawline(point1c,point1r,point2c,point2r, green)
exit when point1c >= point2c
point2c: = point2c + 1
drawline(point1c,point1r,point2c,point2r, green)
exit when point2c >= point1c
end loop
|
What im trying to do is fill it in using Drawline. so i have to fill it in with a loop that i atempted above. so it crosses row's, then another loop were it crosses the coloumns, so it fills in using draw line.
Its simple but I cant get the draw line with the loop to work, it displays a failed outline.
Please help.
Thanks.
*also to make the box, enter the 1st 2nd 3rd 4th as.
10
10
10
20
20
20
20
10
to form a box. |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: Fri Nov 13, 2009 12:03 pm Post subject: RE:Fill using Drawline. |
|
|
If I enter box co-ordinates 10/10/10/20/...
What does point1c >= point2c in
code: |
exit when point1c >= point2c
|
evaluate to, the first time it's checked?
How many times does the loop execute? |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
|
|