Advertisement
olaaa

Untitled

Oct 16th, 2019
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3.  
  4. using namespace std;
  5.  
  6.  
  7. int main()
  8. {
  9. int a = 0, b = 0, c = 0, d = 0, x = 0, y = 0;
  10. float x1 = 0, y1 = 0;
  11.  
  12.  
  13. cout << "Podaj wspolrzedne punktu A "<<endl;
  14. cin >> a; cin>> b;
  15. cout << "Podaj wspolrzedne punktu B" << endl;
  16. cin >> c; cin >> d;
  17.  
  18. x = pow(a, 2) + pow(b, 2);
  19. x1=sqrt(x);
  20.  
  21. y = pow(c, 2) + pow(d, 2);
  22. y1 = sqrt(y);
  23.  
  24. if ((x1 - y1) >= 0) {
  25. cout << (x1 - y1) << endl;
  26. }
  27. if ((x1 - y1) < 0) {
  28. cout << (y1 - x1) << endl;
  29. }
  30. retur 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement