From be66c857b3065b8e6683579500e6b5b7aecb4e44 Mon Sep 17 00:00:00 2001 From: "exercism-solutions-syncer[bot]" <211797793+exercism-solutions-syncer[bot]@users.noreply.github.com> Date: Mon, 3 Aug 2026 13:18:52 +0000 Subject: [PATCH] [Sync Iteration] cpp/hello-world/1 --- solutions/cpp/hello-world/1/hello_world.cpp | 8 ++++++++ solutions/cpp/hello-world/1/hello_world.h | 22 +++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 solutions/cpp/hello-world/1/hello_world.cpp create mode 100644 solutions/cpp/hello-world/1/hello_world.h diff --git a/solutions/cpp/hello-world/1/hello_world.cpp b/solutions/cpp/hello-world/1/hello_world.cpp new file mode 100644 index 000000000000..a92cc126c8dd --- /dev/null +++ b/solutions/cpp/hello-world/1/hello_world.cpp @@ -0,0 +1,8 @@ +#include "hello_world.h" + +using namespace std; + +namespace hello_world { + +string hello() { return "Hello, World!"; } +} // namespace hello_world diff --git a/solutions/cpp/hello-world/1/hello_world.h b/solutions/cpp/hello-world/1/hello_world.h new file mode 100644 index 000000000000..191a60fdfcdd --- /dev/null +++ b/solutions/cpp/hello-world/1/hello_world.h @@ -0,0 +1,22 @@ +// This is an include guard. +// You could alternatively use '#pragma once' +// See https://en.wikipedia.org/wiki/Include_guard +#if !defined(HELLO_WORLD_H) +#define HELLO_WORLD_H + +// Include the string header so that we have access to 'std::string' +#include + +// Declare a namespace for the function(s) we are exporting. +// https://en.cppreference.com/w/cpp/language/namespace +namespace hello_world { + +// Declare the 'hello()' function, which takes no arguments and returns a +// 'std::string'. The function itself is defined in the hello_world.cpp source +// file. Because it is inside of the 'hello_world' namespace, it's full name is +// 'hello_world::hello()'. +std::string hello(); + +} // namespace hello_world + +#endif