classe dei punti...


codice:
#include "class_point.h"
#include <cmath>
#include <vector>
#include <iostream>

using namespace std;

class_point::class_point(float ascissa, float ordinata)
{
    x = ascissa;
    y = ordinata;
}

class_point::~class_point()
{
}

float class_point::getX() {
    return x;
}

float class_point::getY() {
    return y;
}

void class_point::setCartesian(float newX, float newY) {
    x = newX;
    y = newY;
}

float class_point::dist(class_point& other) {
    float x_1 = other.getX();
    float y_1 = other.getY();
    float delta_x = x_1 - x;
    float delta_y = y_1 - y;
    float d = sqrt((delta_x * delta_x) + (delta_y * delta_y));
    return d;
}
classe dei cerchi

codice:
#ifndef CLASS_CIRCLE_H
#define CLASS_CIRCLE_H
#include "class_point.h"

class class_circle
{
public:
    class_circle(float r, class_point* centro);
    
    float stampaXcentro(); 
    float stampaYcentro(); 
    
private:

    class_point* center;
};

#endif // CLASS_CIRCLE_H


// metodi

#include "class_circle.h"

class_circle::class_circle(float raggio, class_point* centro)
{
    radius = raggio;
    center = centro;
}


float class_circle::stampaXcentro()
{
    float x;
    return x = center->getX();
}

float class_circle::stampaYcentro()
{
    float y;
    return y = center->getY();
}