Advertisement
Guest User

Untitled

a guest
Mar 7th, 2012
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #include <iostream>
  2. #include <graphics.h>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int x1,y1,x2,y2;
  8. float m;
  9. cout << "x1: "; cin >> x1;
  10. cout << "y1: "; cin >> y1;
  11. cout << "x2: "; cin >> x2;
  12. cout << "y2: "; cin >> y2;
  13.  
  14. m = (double)(y2-y1)/(x2-x1)*-1;
  15.  
  16. initwindow(480,320,"test",300,200,false,true);
  17.  
  18. for (int x = x1; x<=x2; x++)
  19. {
  20. putpixel(x,(double)(m*x),GREEN);
  21. delay(50);
  22. }
  23.  
  24. closegraph(ALL_WINDOWS);
  25. cin.get();
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement