Length of Diagonals of a Cyclic Quadrilateral using the length of Sides . | C ++ Program to implement the above approach ; Function to calculate the length of diagonals of a cyclic quadrilateral ; Driver Code ; Function Call ; Print the final answer
#include <bits/stdc++.h> NEW_LINE using namespace std ; vector < float > Diagonals ( int a , int b , int c , int d ) { vector < float > ans ; ans . push_back ( sqrt ( ( ( a * c ) + ( b * d ) ) * ( ( a * d ) + ( b * c ) ) / ( ( a * b ) + ( c * d ) ) ) ) ; ans . push_back ( sqrt ( ( ( a * c ) + ( b * d ) ) * ( ( a * b ) + ( c * d ) ) / ( ( a * d ) + ( b * c ) ) ) ) ; return ans ; } int main ( ) { int A = 10 ; int B = 15 ; int C = 20 ; int D = 25 ; vector < float > ans = Diagonals ( A , B , C , D ) ; printf ( " % .2f ▁ % .2f " , ( ans [ 0 ] ) + .01 , ans [ 1 ] + .01 ) ; }