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

#include <iostream>

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

/// dreidimensionaler Punkt
struct Point
{
    double x;
    double y;
    double z;
};

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

/// 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()
{
    // ersten Punkt definieren
    Point a;
    a.x = 1.0;
    a.y = 2.0;
    a.z = 3.0;

    // zweiten Punkt definieren
    Point b;
    b.x = 0.1;
    b.y = 0.2;
    b.z = 0.3;

    // Punkte addieren
    Point c = a + b;

    // Ergebnis ausgeben
    print(c);

    return 0;
}