Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "bits/stdc++.h"
- #include "graphics.h"
- using namespace std;
- int main() {
- int _driver = DETECT,gm;
- initgraph(&_driver,&gm,(char*)"");
- int x0,x1,y0,y1;
- cin >> x0 >> y0 >> x1 >> y1;
- int dx = x1 - x0;
- int dy = y1 - y0;
- int start_x = x0,start_y = y0;
- int p = 2 * dy - dx;
- for (int rep = x0; rep <= x1; ++rep) {
- // cout << start_x << ' ' << start_y << '\n';
- putpixel(start_x,start_y,WHITE);
- delay(300);
- start_y += (p >= 0);
- p += (p >= 0 ? (2 * dy - 2 * dx) : (2 * dy));
- ++start_x;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement