feat!: removed static_cast
This commit is contained in:
parent
104bd0a78c
commit
94429c69e1
1 changed files with 3 additions and 4 deletions
7
main.cpp
7
main.cpp
|
@ -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 = "";
|
||||
|
|
Loading…
Reference in a new issue