Why do you calculate with BCD numbers?
To be easy to print iterations.
Wouldn't it be more convenient and faster to calculate in binary?
Yes, will be a lot faster if it's not necessary print all iterations value I suppose.
Well, convert decimal input string into binary number; do arithmetic on binary number, after each iteration convert binary number to decimal string and print. It's necessary check timings.
Follow a new attached version. For a reason that I don't understand it's not accepting input redirected files. I'm without win64 debug here.
If theres a file name "six.txt", and inside this file exist string "6",<enter> so it works. But when I try giant values I'm receiving an error (SEH I suppose).
collatz <six.txt >result.txt
To redirect output to a file it's working fine:
collatz >result.txt