Maybe you're looking for a simpler answer, but in a pinch you can do this:
printf("%c%#13.4g\n", digit < 0 ? '-' : '+', fabs(digit));
Domanda
I need to seperate digit from sign. So, if I have digit 2635, I need it to be like this:
"+ 2635."
Here is my code:
printf("%+-#13.4g\n", digit);
and what I'm getting is
"+2635. "
Soluzione
Maybe you're looking for a simpler answer, but in a pinch you can do this:
printf("%c%#13.4g\n", digit < 0 ? '-' : '+', fabs(digit));