From b3c6e203eddb939b9d08e168a09c66af3ed94e57 Mon Sep 17 00:00:00 2001 From: Daniel Andreas Wang Date: Sat, 7 Mar 2026 10:10:20 +0000 Subject: first commit --- counter.cpp | 13 +++++++++++++ counter.h | 11 +++++++++++ main.cpp | 13 +++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 counter.cpp create mode 100644 counter.h create mode 100644 main.cpp diff --git a/counter.cpp b/counter.cpp new file mode 100644 index 0000000..c60b7b4 --- /dev/null +++ b/counter.cpp @@ -0,0 +1,13 @@ +#include "counter.h" + +Counter::Counter(int start_value) { + value = start_value; +} + +void Counter::increment() { + value++; +} + +int Counter::get_value() const { + return value; +} diff --git a/counter.h b/counter.h new file mode 100644 index 0000000..5083c45 --- /dev/null +++ b/counter.h @@ -0,0 +1,11 @@ +#pragma once + +class Counter { + public: + Counter(int start_value); + void increment(); + int get_value() const; + + private: + int value; +}; diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..2079353 --- /dev/null +++ b/main.cpp @@ -0,0 +1,13 @@ +#include +#include "counter.h" + +using std::cout, std::endl; + +int main() { + Counter c(0); + + c.increment(); + cout << c.get_value() << endl; + + return 0; +} -- cgit