 ok, so I have to do this problem to solve :
Create a class Road that contains different stop points. A point is characterized by
latitude, longitude, altitude.
a. Validate the correctness of the values
b. Create an array of Roads and display it
d. Display the Road with minimum, maximum stop points.
e. Display all Roads that contain a certain stop point

Here is my partial solution... can you please tell me whats wrong with my destcutors or constructors?

``````    #include <iostream>
#include <cmath>
#include <cstring>
const double PI = 3.14159265;
using namespace std;

{
double radians = (d / 360) * (2.0 * PI);
}

{
int R = 6371, i = 1, s = 0;     // km
double dLat, dLon, lat1, lat2,lon1, lon2, a, c, d;
while ( i <= max_size )
{
i++;

a = sin(dLat/2) * sin(dLat/2) +
sin(dLon/2) * sin(dLon/2) *
cos(lat1) * cos(lat2);
c = 2 * atan2(sqrt(a), sqrt(1-a));
d = R * c;
s+= d;
}
return s;

}

{
double dLat, dLon, lat1, lat2,lon1, lon2, a, c, d;
int R = 6371;
lat1 = x.lat;
lat2 = y.lat;
lon1 = x.lon;
lon2 = y.lon;
a = sin(dLat/2) * sin(dLat/2) +
sin(dLon/2) * sin(dLon/2) *
cos(lat1) * cos(lat2);
c = 2 * atan2(sqrt(a), sqrt(1-a));
d = R * c;
cout<<d;
return 0;
}
/*
{
pointSize = 0;
}
*/
{
if(s != NULL)
strcpy(this->name, s);
this->pointSize = max_size;
for(int i = 0; i < this->pointSize; i++)
this->x[i] = new point(p[i]);
cout<<this;
}

{
if(this->name != NULL)
delete this->name;
if(this->pointSize != 0)
{
for(int i =0; i <this->pointSize; i++)
delete this->x[i];
}
}

{
int i = 0;
if(this->name != NULL)
cout<<"POINTS: "<<endl;
for(i = 0; i < this->pointSize; i++)
{
cout<<"POINT "<<i+1<<":"<<endl;
cout<<"LAT: "<<this->x[i]->lat<<" ";
cout<<"LON: "<<this->x[i]->lon<<" ";
cout<<"ALT: "<<this->x[i]->alt<<endl;
}
}
``````
``````#include "point.h"

{
char *name;
point *x;
int pointSize;
public:
void display();
void display_certain(double, double, double = 0);
double calc_point(point , point );
};
``````
point.h
``````#ifndef POINT_H_INCLUDED
#define POINT_H_INCLUDED

class point
{

public:
double lat, lon, alt;
point(double = 0.0, double = 0.0, double = 0.0);
point(const point&p);
~point();
void display();
private:
double validatepoint(double);
};

#endif // POINT_H_INCLUDED
``````
point.cpp
``````#include "point.h"
#include <iostream>
using namespace std;
point::point(double lat, double lon, double alt)
{
this->lat = validatepoint(lat);
this->lon = validatepoint(lon);
this->alt = validatepoint(alt);
cout<<"CONSTRUCTOR POINT"<<this<<" ";
cout<<endl;
}
point::point(const point&p)
{
this->lat = p.lat;
this->lon = p.lon;
this->alt = p.alt;
cout<<"copy constructor POINT"<<this<<" ";
display();
cout << endl;
}
point::~point()
{
cout << "destructor POINT " << this << " ";
display();
cout << endl;
}

void point::display()
{
cout << "[" << this->lat << "," << this->lon << "," << this->alt << "]";
cout << endl;
}

double point::validatepoint(double p){
if ( -300<=p && p<=300){
return p;
}
return 0;
}
``````

and then in the end I try to create an obj, but it errors after it compiles:

main.cpp
``````#include <iostream>
using namespace std;
int main()
{
point coords(2,3,5);
coords.display();