feat!: removed static_cast

This commit is contained in:
moonleay 2024-11-20 17:24:44 +01:00
parent 104bd0a78c
commit 94429c69e1
Signed by: moonleay
GPG key ID: 82667543CCD715FB

View file

@ -25,8 +25,7 @@ int main()
cout << "Zahl ausserhalb des gueltigen Bereichs.\n";
continue;
}
// TODO: remove static_cast
int input_length = static_cast<int>(std::to_string(input).length());
int first_digit = input % 10;
int last_two_digits = input % 100;
int middle_digit = ((last_two_digits) - first_digit) / 10;
@ -52,12 +51,12 @@ int main()
}
result.push_back(suffix);
if (input_length > 1 && (last_two_digits < 11 || last_two_digits > 12))
if ((input > 9 /*input_length > 1*/) && (last_two_digits < 11 || last_two_digits > 12))
result.push_back(middle_digit_strings[middle_digit]);
else
result.push_back("");
if (input_length == 3)
if (input > 99 /*input_length >= 3*/)
{
int last_digit = ((input % 1000) - middle_digit) / 100;
string suffix = "";