ok, i need help with using arrays with functions, the following code is supposed to calculate the centroid and area of a polygon, but so far i can only get it to calculate squat, any help would be appreciated(yes i do know there are several things wrong but do not know how to correct them)


#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

void getxy (double&, double&);
void calccent (double&, double&);
void answer (double&, double&, double&);

int main()
{
double centx, centy, area;
int n;
double x[]= {n};
double y[]= {n};
getxy (x[n],y[n]);
calccent (x[n],y[n]);
answer (centx, centy, area);
system ("PAUSE");
}
void getxy (double& x[n], double& y[n])
{
int n;
double x[]= {n};
double y[]= {n};
cout << "Enter x and y separated by a space: ";
cin >> x[0];
cin >>y[0];

while (x[n+1]!=x[0] || y[n+1]!=y[0])
{
int n;
cout <<"Insert x and y separated by a space: ";
cin >> x[n];
cin >> y[n];
n=0;
n++;
}
}
void calccent (double& centx, double& centy, double& x[n], double& y[n], double& area)
{
int n;
area=-((y[n+1]-y[n])*(x[n+1]-x[n]))/2;
centx=-(1/area)*((y[n+1]-y[n])/8))*(pow((x[n+1]+x[n]),2))+(pow((x[n+1]-x[n]),2))/3;
centy=(1/area)*((x[n+1]-x[n])/8))*(pow((y[n+1]+y[n]),2))+(pow((y[n+1]-y[n]),2))/3;
}
void answer (double& centx, double& centy, double& area)
{
cout << "These are the centroid coordinates: " << centx << "," << centy;
cout << "\nThis is area of the polygon: " << area << endl;
}