Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<math.h>
- int main() {
- //~ int _driver = DETECT,gm;
- float x0 = 100,x1 = 200,y0 = 200,y1 = 300;
- float dx = x1 - x0;
- float dy = y1 - y0;
- int steps = 0;
- if (dx > dy) steps = dx;
- else steps = dy;
- double x_inc = dx / steps;
- double y_inc = dy / steps;
- int x_cor = round(x0);
- int y_cor = round(y0);
- printf("%d %d\n",x_cor,y_cor);
- while (steps--) {
- //putpixel(x0,y0,BLUE);
- x0 += x_inc;
- y0 += y_inc;
- x_cor = round(x0);
- y_cor = round(y0);
- printf("%d %d\n",x_cor,y_cor);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement