From 3f2a40cc78ba61c7bbf226f28a2ba6df4a36db99 Mon Sep 17 00:00:00 2001 From: "exercism-solutions-syncer[bot]" <211797793+exercism-solutions-syncer[bot]@users.noreply.github.com> Date: Sat, 25 Apr 2026 08:38:20 +0000 Subject: [PATCH] [Sync Iteration] cpp/last-will/1 --- solutions/cpp/last-will/1/last_will.cpp | 66 +++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 solutions/cpp/last-will/1/last_will.cpp diff --git a/solutions/cpp/last-will/1/last_will.cpp b/solutions/cpp/last-will/1/last_will.cpp new file mode 100644 index 0000000..027ff11 --- /dev/null +++ b/solutions/cpp/last-will/1/last_will.cpp @@ -0,0 +1,66 @@ +// Enter your code below the lines of the families' information + +// Secret knowledge of the Zhang family: +namespace zhang { +int bank_number_part(int secret_modifier) { + int zhang_part{8'541}; + return (zhang_part * secret_modifier) % 10000; +} +namespace red { +int code_fragment() { return 512; } +} // namespace red +namespace blue { +int code_fragment() { return 677; } +} // namespace blue +} // namespace zhang + +// Secret knowledge of the Khan family: +namespace khan { +int bank_number_part(int secret_modifier) { + int khan_part{4'142}; + return (khan_part * secret_modifier) % 10000; +} +namespace red { +int code_fragment() { return 148; } +} // namespace red +namespace blue { +int code_fragment() { return 875; } +} // namespace blue +} // namespace khan + +// Secret knowledge of the Garcia family: +namespace garcia { +int bank_number_part(int secret_modifier) { + int garcia_part{4'023}; + return (garcia_part * secret_modifier) % 10000; +} +namespace red { +int code_fragment() { return 118; } +} // namespace red +namespace blue { +int code_fragment() { return 923; } +} // namespace blue +} // namespace garcia + +// Enter your code below +namespace estate_executor{ + int assemble_account_number(int secret_modifier){ + int result{zhang::bank_number_part(secret_modifier)+ + khan::bank_number_part(secret_modifier)+ + garcia::bank_number_part(secret_modifier)}; + return result; + } + int assemble_code(){ + + int blue_sum = zhang::blue::code_fragment() + + khan::blue::code_fragment() + + garcia::blue::code_fragment(); + + int red_sum = zhang::red::code_fragment()+ + khan::red::code_fragment() + + garcia::red::code_fragment(); + + return blue_sum * red_sum; + } + +} \ No newline at end of file