Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <graphics.h>
- using namespace std;
- int main()
- {
- int x1,y1,x2,y2;
- float m;
- cout << "x1: "; cin >> x1;
- cout << "y1: "; cin >> y1;
- cout << "x2: "; cin >> x2;
- cout << "y2: "; cin >> y2;
- m = (double)(y2-y1)/(x2-x1)*-1;
- initwindow(480,320,"test",300,200,false,true);
- for (int x = x1; x<=x2; x++)
- {
- putpixel(x,(double)(m*x),GREEN);
- delay(50);
- }
- closegraph(ALL_WINDOWS);
- cin.get();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement