From c9b6b9a5ca082fe7c1b6f58d7713f785a9eb6a5c Mon Sep 17 00:00:00 2001 From: Martial Simon Date: Mon, 15 Sep 2025 01:08:27 +0200 Subject: add: graphs et rushs --- graphs/cpp/cartesian_vector/vector.hh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 graphs/cpp/cartesian_vector/vector.hh (limited to 'graphs/cpp/cartesian_vector/vector.hh') diff --git a/graphs/cpp/cartesian_vector/vector.hh b/graphs/cpp/cartesian_vector/vector.hh new file mode 100644 index 0000000..b18838c --- /dev/null +++ b/graphs/cpp/cartesian_vector/vector.hh @@ -0,0 +1,29 @@ +#pragma once +#include + +#include "format_numerical_data.hh" + +class Vector +{ +public: + Vector() = default; + Vector(double x, double y); + double get_x() const; + double get_y() const; + + Vector& operator+=(const Vector& rhs); + Vector& operator-=(const Vector& rhs); + Vector& operator*=(double scalar); + + friend Vector operator+(const Vector& lhs, const Vector& rhs); + friend Vector operator-(const Vector& lhs, const Vector& rhs); + friend Vector operator*(const Vector& lhs, double scalar); + friend Vector operator*(double scalar, const Vector& rhs); + friend double operator*(const Vector& lhs, const Vector& rhs); + friend std::ostream& operator<<(std::ostream& os, const Vector& vec); + +private: + double x_ = 0; + double y_ = 0; + static FormatNumericalData format_numerical_data_; +}; -- cgit v1.2.3