feat: added 17 edge case

This commit is contained in:
moonleay 2024-11-21 23:00:33 +01:00
parent fad8119dc0
commit b2a5350322
Signed by: moonleay
GPG key ID: 82667543CCD715FB

View file

@ -31,7 +31,7 @@ int main()
vector<string> result; vector<string> result;
string number_constructor = ""; 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 // Handle everything else
if (right_digit == 1) if (right_digit == 1)
@ -45,12 +45,14 @@ int main()
// Handle 11 and 12 // Handle 11 and 12
if (middle_and_right_digit == 11) if (middle_and_right_digit == 11)
number_constructor = "elf"; number_constructor = "elf";
else else if (middle_and_right_digit == 12)
number_constructor = "zwoelf"; number_constructor = "zwoelf";
else
number_constructor = "siebzehn";
} }
result.push_back(number_constructor); 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]); result.push_back(middle_digit_strings[middle_digit]);
else else
result.push_back(""); result.push_back("");