i want to convert this program to read it in c-free (C++)
plllllllzzzz i need this now !! thanx all
#include<stdio.h>
#include<math.>
using namespace std;
float x[20], y[20];
void get_corners(int n, float x[], float y[]){
int tempx,tempy;
for(int i=0; i<n; i++)
{
cout<<"Enter (x, y) for point "<<i<<endl;
cin>>tempx;
x[i]=tempx;
cin>>tempy;
y[i]=tempy;
}
if(((x[0]!=x[n-1]))||(y[0]!=y[n-1]))
exit (EXIT_FAILURE);
}
void output_corners(int n, float x[], float y[]){
cout<<" x(m) y(m)"<<endl;
cout<<"-------------------------"<<endl;
for(int i=0; i<n; i++)
{
cout<<" ";
cout<<x[i]<<" "<<y[i]<<endl;
}
cout<<endl;
cout<<"-------------------------"<<endl;
}
float polygon_area(int n, float x[], float y[]){
float a=0;
for(int i=0; i<=n-2; i++)
{
a += (x[i+1]+x[i])*(y[i+1]-y[i]);
}
a = abs(0.5*a);
return a;
}
float polygon_price(float a){
if(a>=0 && a<=499.99)
return a*3000;
if(a>=500 && a<=1999.99)
return a*3500;
if(a>=2000 && a<=3999.99)
return a*4000;
if(a>=4000)
return a*5000;
}
void int(){
//double x[20]={40,40,70,70,90,70,40};
//double y[20]={0,75,75,30,0,0,0};
int n;
cout<<"Enter number of corner points:"<<endl;
cin>>n;
n=n+1;
if((n<4)||(n>20))
exit (EXIT_FAILURE);
float a = 0, price = 0;
get_corners(n,x,y);
output_corners(n,x,y);
a = polygon_area(n,x,y);
price = polygon_price(a);
cout<<endl;
cout.precision(15);
cout<<"Area = "<<a<<" m2,";
cout<<" ";
cout<<"Price = "<<price<<" Dhs";
cout<<endl<<endl;
return 0;
}