1234567891011121314151617181920212223242526272829303132333435363738 | #include <iostream> #include <cmath> using namespace std; struct Point { int x; int y; }; struct Triangle { struct Point a; struct Point b; struct Point c; }; int dst(struct Point a, struct Point b) { int x = a.x - b.y; int y = b.x - b.y; return (sqrt(x * x + y * y)); } int obw(struct Triangle tr) { return dst(tr.a, tr.b) + dst(tr.b, tr.c) + dst(tr.c, tr.a); } int main() { struct Triangle tr { 0, 0, 0, 3, 4, 0 }; cout << obw(tr); return 0; } |