diff options
| author | Martial Simon <msimon_fr@hotmail.com> | 2025-09-15 01:08:27 +0200 |
|---|---|---|
| committer | Martial Simon <msimon_fr@hotmail.com> | 2025-09-15 01:08:27 +0200 |
| commit | c9b6b9a5ca082fe7c1b6f58d7713f785a9eb6a5c (patch) | |
| tree | 3e4f42f93c7ae89a364e4d51fff6e5cec4e55fa9 /graphs/cpp/cartesian_vector/vector.hh | |
add: graphs et rushs
Diffstat (limited to 'graphs/cpp/cartesian_vector/vector.hh')
| -rw-r--r-- | graphs/cpp/cartesian_vector/vector.hh | 29 |
1 files changed, 29 insertions, 0 deletions
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 <iostream> + +#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_; +}; |
