Advertisement
Pocket_Compass

Untitled

Apr 27th, 2016
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. #define DIAGONAL(xi,yi,xs,ys) (xs)-(xi)>=0 && (ys)-(yi)>=0?\
  2. sqrt(((xs)-(xi))*((xs)-(xi))+((ys)-(yi))*((ys)-(yi))):\
  3. 0
  4.  
  5. ----------- APLICADA ------------
  6.  
  7. #include <stdio.h>
  8. #include <math.h>
  9. #define DELTA 0
  10. #define DIAGONAL(xi,yi,xs,ys) (xs)-(xi)>=0 && (ys)-(yi)>=0?\
  11. sqrt(((xs)-(xi))*((xs)-(xi))+((ys)-(yi))*((ys)-(yi))):\
  12. 0
  13.  
  14. int main()
  15. {
  16. int x1,y1,x2,y2;
  17.  
  18. x1 = 2;
  19. y1 = 1;
  20. x2 = 1;
  21. y2 = 2;
  22.  
  23. printf("La distancia de la punta (%d,%d) hasta la punta (%d,%d) es %g\n", x1,y1,x2+DELTA,y2+DELTA, DIAGONAL(x1,y1,x2+DELTA,y2+DELTA));
  24.  
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement