M
Michel Rouzic
I can't think of a simple way to print integers with a fix number of
digits, in order to obtain something like 0001 for 1 and 0100 for 100
automatically just by specifying in a variable the number of desired
digits.
I thought about printing to a variable using for example %4d and then
replace ' ' by '0', but I don't know if i can print to an array, and
then I don't think I can put a variable between % and d to specify the
number of digits I want.
I thought that maybe there would be some already existing and easy way
to do it that I don't know of, otherwise i'd like to know how people
usually deal with that problem, thanks
digits, in order to obtain something like 0001 for 1 and 0100 for 100
automatically just by specifying in a variable the number of desired
digits.
I thought about printing to a variable using for example %4d and then
replace ' ' by '0', but I don't know if i can print to an array, and
then I don't think I can put a variable between % and d to specify the
number of digits I want.
I thought that maybe there would be some already existing and easy way
to do it that I don't know of, otherwise i'd like to know how people
usually deal with that problem, thanks