It is necessary to write a function that calculates the length of the segment according to the coordinates of its ends. Using this function, calculate the perimeter of a triangle using the coordinates of its three vertices. All numbers do not exceed 30,000 in absolute value. The perimeter value of this triangle with an accuracy of up to 6 digits after the decimal point. Here is my program, passes 25/32 tests. What needs to be fixed?
#include <iostream> #include <cmath> double L (int x, int y ,int x1, int y1) { return sqrt( ( x- x1 )*( x- x1 ) + ( y-y1 )*( y-y1 )); } long int a,b,c,d,e,f; double s1,s2,s3,s,p,P; using namespace std; int main() { cin>>a>>b>>c>>d>>e>>f; s1=L(a,b,c,d); s2=L(c,d,e,f); s3=L(e,f,a,b); P=s1+s2+s3; cout<<P; return 0; }