From d05a9f44fa1b7534bec86acda6626e231fb40b61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Gil=20de=20G=C3=B3mez=20P=C3=A9rez?= Date: Tue, 18 Aug 2026 10:07:24 +0300 Subject: [PATCH] Solved: 36 - Digit Separators --- modules/10_cpp14/src/digit_separators.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/modules/10_cpp14/src/digit_separators.cpp b/modules/10_cpp14/src/digit_separators.cpp index b3babbe..402a52d 100644 --- a/modules/10_cpp14/src/digit_separators.cpp +++ b/modules/10_cpp14/src/digit_separators.cpp @@ -4,17 +4,22 @@ namespace cpp14 { auto million() -> int { // TODO: Return 1'000'000 using digit separators - return 0; + return 1'000'000; } auto mask() -> std::uint32_t { // TODO: Return 0xFF00'00FF - return 0; + return 0xFF00'00FF; } auto bits_set() -> int { // TODO: Return population count of mask() - return 0; + const auto m = mask(); + auto count = 0; + for (auto i = 0; i < 32; i++) { + if (m & (1 << i)) ++count; + } + return count; } } // namespace cpp14