#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main( ) {
// Variables for the coordinates of the vertices of the quadrilateral
double x1, y1, x2, y2, x3, y3, x4, y4;
// Input of the coordinates of the vertices
cout << "Enter the coordinates of the four vertices of the quadrilateral:\n " ;
cout << "Coordinates of vertex A (x1, y1): " ;
cin >> x1 >> y1;
cout << "Coordinates of vertex B (x2, y2): " ;
cin >> x2 >> y2;
cout << "Coordinates of vertex C (x3, y3): " ;
cin >> x3 >> y3;
cout << "Coordinates of vertex D (x4, y4): " ;
cin >> x4 >> y4;
// Comparison of the diagonal
double diagonal_AC = sqrt ( pow ( x3 - x1, 2 ) + pow ( y3 - y1, 2 ) ) ; // Diagonal AC
double diagonal_BD = sqrt ( pow ( x4 - x2, 2 ) + pow ( y4 - y2, 2 ) ) ; // Diagonal BD
// Comparison of the diagonals
cout << fixed << setprecision( 2 ) ;
if ( diagonal_AC > diagonal_BD) {
cout << "The longer diagonal is AC = " << diagonal_AC << endl;
} else if ( diagonal_BD > diagonal_AC) {
cout << "The longer diagonal is BD = " << diagonal_BD << endl;
} else {
cout << "Both diagonals are equal: AC = BD = " << diagonal_AC << endl;
}
return 0 ;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y21hdGg+CiNpbmNsdWRlIDxpb21hbmlwPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluKCkgewogICAgLy8gVmFyaWFibGVzIGZvciB0aGUgY29vcmRpbmF0ZXMgb2YgdGhlIHZlcnRpY2VzIG9mIHRoZSBxdWFkcmlsYXRlcmFsCiAgICBkb3VibGUgeDEsIHkxLCB4MiwgeTIsIHgzLCB5MywgeDQsIHk0OwoKICAgIC8vIElucHV0IG9mIHRoZSBjb29yZGluYXRlcyBvZiB0aGUgdmVydGljZXMKICAgIGNvdXQgPDwgIkVudGVyIHRoZSBjb29yZGluYXRlcyBvZiB0aGUgZm91ciB2ZXJ0aWNlcyBvZiB0aGUgcXVhZHJpbGF0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