diff options
Diffstat (limited to 'graphs/cpp/point')
| -rw-r--r-- | graphs/cpp/point/CMakeLists.txt | 7 | ||||
| -rw-r--r-- | graphs/cpp/point/main.cc | 7 | ||||
| -rw-r--r-- | graphs/cpp/point/point.cc | 14 | ||||
| -rw-r--r-- | graphs/cpp/point/point.hh | 12 |
4 files changed, 40 insertions, 0 deletions
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 <iostream> + +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 <iostream> + +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 |
