From b2a53503228206f80e87c28f55dfe97790cca1e2 Mon Sep 17 00:00:00 2001 From: moonleay Date: Thu, 21 Nov 2024 23:00:33 +0100 Subject: [PATCH] feat: added 17 edge case --- main.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/main.cpp b/main.cpp index d824e6b..f7fb51d 100644 --- a/main.cpp +++ b/main.cpp @@ -31,7 +31,7 @@ int main() vector result; string number_constructor = ""; - if (middle_and_right_digit < 11 || middle_and_right_digit > 12) + if ((middle_and_right_digit < 11 || middle_and_right_digit > 12) && middle_and_right_digit != 17) { // Handle everything else if (right_digit == 1) @@ -45,12 +45,14 @@ int main() // Handle 11 and 12 if (middle_and_right_digit == 11) number_constructor = "elf"; - else + else if (middle_and_right_digit == 12) number_constructor = "zwoelf"; + else + number_constructor = "siebzehn"; } result.push_back(number_constructor); - if ((input > 9 /*input_length > 1*/) && (middle_and_right_digit < 11 || middle_and_right_digit > 12)) + if ((input > 9 /*input_length > 1*/) && (middle_and_right_digit < 11 || middle_and_right_digit > 12) && middle_and_right_digit != 17) result.push_back(middle_digit_strings[middle_digit]); else result.push_back("");