/// @file   main.cpp
/// @author Jens Gruschel
/// @date   2016-07-14
/// verbesserter Point-Typ

#include <iostream>

using std::cout;
using std::endl;

/// dreidimensionaler Punkt
struct Point
{
    Point(const double x, const double y, const double z);
    double x;
    double y;
    double z;
};

/// Konstruktor
Point::Point(const double x, const double y, const double z) :
    x(x), y(y), z(z)
{}

/// Addition zweier Punkte / Vektoren
Point operator+(const Point& first, const Point& second)
{
    return Point(first.x + second.x,
                 first.y + second.y,
                 first.z + second.z);
}

/// Punktkoordinaten auf Konsole ausgeben
void print(const Point& p)
{
    cout << "x: " << p.x << endl;
    cout << "y: " << p.y << endl;
    cout << "z: " << p.z << endl;
}

int main()
{
    // Punkte definieren
    Point a(1.0, 2.0, 3.0);
    Point b(0.1, 0.2, 0.3);

    // Punkte addieren
    Point c = a + b;

    // Ergebnis ausgeben
    print(c);

    return 0;
}