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/point/CMakeLists.txt | 7 +++++++ graphs/cpp/point/main.cc | 7 +++++++ graphs/cpp/point/point.cc | 14 ++++++++++++++ graphs/cpp/point/point.hh | 12 ++++++++++++ 4 files changed, 40 insertions(+) create mode 100644 graphs/cpp/point/CMakeLists.txt create mode 100644 graphs/cpp/point/main.cc create mode 100644 graphs/cpp/point/point.cc create mode 100644 graphs/cpp/point/point.hh (limited to 'graphs/cpp/point') diff --git a/graphs/cpp/point/CMakeLists.txt b/graphs/cpp/point/CMakeLists.txt new file mode 100644 index 0000000..0933e1c --- /dev/null +++ b/graphs/cpp/point/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.30) +project(point) + +set(CMAKE_CXX_STANDARD 20) + +add_executable(point main.cc + point.cc) diff --git a/graphs/cpp/point/main.cc b/graphs/cpp/point/main.cc new file mode 100644 index 0000000..df28b27 --- /dev/null +++ b/graphs/cpp/point/main.cc @@ -0,0 +1,7 @@ +#include + +int main() +{ + std::cout << "Hello, World!" << std::endl; + return 0; +} \ No newline at end of file diff --git a/graphs/cpp/point/point.cc b/graphs/cpp/point/point.cc new file mode 100644 index 0000000..557cab9 --- /dev/null +++ b/graphs/cpp/point/point.cc @@ -0,0 +1,14 @@ +#include "point.hh" + +#include + +void Point::display() const +{ + std::cout << "(" << x_ << ", " << y_ << ")"; +} + +void Point::shift(const int dx, const int dy) +{ + x_ += dx; + y_ += dy; +} diff --git a/graphs/cpp/point/point.hh b/graphs/cpp/point/point.hh new file mode 100644 index 0000000..1e33fc8 --- /dev/null +++ b/graphs/cpp/point/point.hh @@ -0,0 +1,12 @@ +#pragma once + +class Point +{ +public: + void display() const; + void shift(int dx, int dy); + +private: + int x_ = 0; + int y_ = 0; +}; \ No newline at end of file -- cgit v1.2.3