I am trying to print zeros to a certain length to compare with another numbers which is store as string, I was wondering how to do that?
Edit: added sample code
For example:
printf("%s\n", "References:\n3.141592653"
"58979323846264338327950288419716939937510582097494459230781640628620899");
printf("Monte Carlo: %d nodes over %d iterations calculated Pi as:\n%1.9f\n", numnodes,
final_iters,pi); //Print the calculated value of pi
The out is
References:
3.14159265358979323846264338327950288419716939937510582097494459230781640628620899
Monte Carlo 16 nodes over 160000 iterations calculated Pi as:
3.142025000
How would I make the actual calculation fill in zeros to the end of the string?
转载于:https://stackoverflow.com/questions/53111724/printf-following-zeros-to-a-certain-degree