Advertisement
newb_ie

Untitled

Sep 15th, 2021
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. #include "bits/stdc++.h"
  2. #include "graphics.h"
  3. using namespace std;
  4.  
  5. int main() {
  6. int _driver = DETECT,gm;
  7. initgraph(&_driver,&gm,(char*)"");
  8. int x0,x1,y0,y1;
  9. cin >> x0 >> y0 >> x1 >> y1;
  10. int dx = x1 - x0;
  11. int dy = y1 - y0;
  12. int start_x = x0,start_y = y0;
  13. int p = 2 * dy - dx;
  14. for (int rep = x0; rep <= x1; ++rep) {
  15. // cout << start_x << ' ' << start_y << '\n';
  16. putpixel(start_x,start_y,WHITE);
  17. delay(300);
  18. start_y += (p >= 0);
  19. p += (p >= 0 ? (2 * dy - 2 * dx) : (2 * dy));
  20. ++start_x;
  21. }
  22. }
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement