#include <stdio.h>
#define num 10
struct point
{
float x;
float y;
}p[num], cent;
struct point fun(struct point s[], int n);
int main ()
{
int i;
for(i = 0; i < num ; i ++)
{
printf("请输入第%d个点的坐标\n",i + 1);
scanf("%f%f",&p[i].x, &p[i].y);
}
cent = fun(p, num);
printf("重心坐标为:(%f,%f)",cent.x, cent.y);
return 0;
}
struct point fun(struct point s[],int n)
{
struct point temp = {0,0};
for(int i = 0; i < n; i ++)
{
temp.x += s[i].x;
temp.y += s[i].y;
}
temp.x = temp.x / n;
temp.y = temp.y / n;
return temp;
}