Advertisement
newb_ie

Untitled

Sep 7th, 2021
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<math.h>
  3.  
  4. int main() {
  5. //~ int _driver = DETECT,gm;
  6. float x0 = 100,x1 = 200,y0 = 200,y1 = 300;
  7. float dx = x1 - x0;
  8. float dy = y1 - y0;
  9. int steps = 0;
  10. if (dx > dy) steps = dx;
  11. else steps = dy;
  12. double x_inc = dx / steps;
  13. double y_inc = dy / steps;
  14. int x_cor = round(x0);
  15. int y_cor = round(y0);
  16. printf("%d %d\n",x_cor,y_cor);
  17. while (steps--) {
  18. //putpixel(x0,y0,BLUE);
  19. x0 += x_inc;
  20. y0 += y_inc;
  21. x_cor = round(x0);
  22. y_cor = round(y0);
  23. printf("%d %d\n",x_cor,y_cor);
  24. }
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement