Advertisement
Guest User

Untitled

a guest
Jun 19th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. //Задание 1
  2. #include "stdafx.h"
  3. #include <iostream>
  4. #include <math.h>
  5. #include <locale.h>
  6.  
  7. using namespace std;
  8.  
  9. struct Point
  10. {
  11.     float x;
  12.     float y;
  13. };
  14.  
  15. struct Segment {
  16.     Point A;
  17.     Point B;
  18. };
  19.  
  20. double S(Segment S)
  21. {
  22.     return sqrt(pow((S.B.x - S.A.x), 2) + pow((S.B.y - S.A.y), 2));
  23. }
  24.  
  25. int main()
  26. {
  27.     setlocale(LC_ALL, "Russian");
  28.     Segment Dlin;
  29.     cout << "Введите координаты точки А: ";
  30.     cin >> Dlin.A.x >> Dlin.A.y;
  31.     cout << "Введите координаты точки B: ";
  32.     cin >> Dlin.B.x >> Dlin.B.y;
  33.     cout << "Длина отрезка AB = " << S(Dlin) << endl;
  34.     system("pause");
  35.     return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement