fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <math.h>
  4. using namespace std;
  5. int main ()
  6. {
  7. cout << 1 + -4 << "\n";
  8. signed int x1; //(x1, ...
  9. signed int y1; //(x1, y1)...
  10. signed int x2; //... (x2, ...
  11. signed int y2; // ... (x2, y2)
  12. signed int ans1;
  13. signed int ans2;
  14. signed int ans3;
  15. signed int result;
  16. cout << "X1: ";
  17. cin >> x1;
  18. cout << "\nY1: ";
  19. cin >> y1;
  20. cout << "\nX2: ";
  21. cin >> x2;
  22. cout << "\nY2: ";
  23. cin >> y2;
  24. cout << "\n(" << x1 << ", " << y1 << "), (" << x2 << ", " << y2 << ")\n";
  25. result = (x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1);
  26. cout << "X2 - X1 = " << x2 - x1 << "\n";
  27. cout << "Y2 - Y1 = " << y2 - y1 << "\n";
  28. ans1 = x2 - x1;
  29. ans2 = y2 - y1;
  30. ans3 = ans1 + ans2;
  31. cout << ans1 << " + " << ans2 << " = " << ans3;
  32. cout << result << "\n";
  33. return 0;
  34. }
Success #stdin #stdout 0s 2900KB
stdin
8
6
9
2
stdout
-3
X1: 
Y1: 
X2: 
Y2: 
(8, 6), (9, 2)
X2 - X1 = 1
Y2 - Y1 = -4
1 + -4 = -317