Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Задание 1
- #include "stdafx.h"
- #include <iostream>
- #include <math.h>
- #include <locale.h>
- using namespace std;
- struct Point
- {
- float x;
- float y;
- };
- struct Segment {
- Point A;
- Point B;
- };
- double S(Segment S)
- {
- return sqrt(pow((S.B.x - S.A.x), 2) + pow((S.B.y - S.A.y), 2));
- }
- int main()
- {
- setlocale(LC_ALL, "Russian");
- Segment Dlin;
- cout << "Введите координаты точки А: ";
- cin >> Dlin.A.x >> Dlin.A.y;
- cout << "Введите координаты точки B: ";
- cin >> Dlin.B.x >> Dlin.B.y;
- cout << "Длина отрезка AB = " << S(Dlin) << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement