`#include<iostream>`

using namespace std;

int main(){

int corners = 0;

double x[10], y[10];

double dist;

double Distance;

//enter no. of corners

while (corners < 3 || corners>10){

cout << "Please enter the number of corners, (between 3 and 10) of the fence:" << endl;

cin >> corners;

}

//Ask user to input co-ordinates of the corners

for (int i = 0; i < corners; i++){

cout << "Please input positive x and y values for corner " << i + 1 << endl;

cin >> x >> y;

}

//Calculate distance

int j = corners - 1;

for (int i = 0; i < corners; i++){

dist = (x - x)*(x - x) + (y - y)*(y - y);

j = i;

Distance = sqrt(dist);

}

//Print result

cout << "Distance between these points = " << Distance << " metres." << endl;

return 0;

}