Q:

# Write a C++ program to which prints the central coordinate and the radius of a circumscribed circle of a triangle which is created by three points on the plane surface

Write a C++ program to which prints the central coordinate and the radius of a circumscribed circle of a triangle which is created by three points on the plane surface

Sample Output:

```Sample input : 6 9 7
Sample Output:
7 9 6
```

``````#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main() {
double a, b, c, x1, y1, x2, y2, x3, y3, xp, yp, d, radius;
while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3) {
a = sqrt((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1));
b = sqrt((x3 - x1)*(x3 - x1) + (y3 - y1)*(y3 - y1));
c = sqrt((x3 - x2)*(x3 - x2) + (y3 - y2)*(y3 - y2));
d = 2*(x1*(y2-y3) + x2*(y3-y1) + x3*(y1-y2));
xp = ((x1*x1 + y1*y1)*(y2-y3) + (x2*x2 + y2*y2)*(y3-y1) + (x3*x3 + y3*y3)*(y1-y2))/d;
yp = ((x1*x1 + y1*y1)*(x3-x2) + (x2*x2 + y2*y2)*(x1-x3) + (x3*x3 + y3*y3)*(x2-x1))/d;
cout << fixed << setprecision(3) << "Central coordinate of the circumscribed circle: (" << xp << ", " << yp << ")\nRadius: " << radius << endl;
}
return 0;
}``````