- Home Page of ProjectGuideline.com ›
- Forums ›
- Get Help to do your B.E., and M.E., M.Tech., & M.S., Project in Ns2 ›
- Which function to get it a number with some digits
pedro
Participant
Hello,
Could anybody please help me soon:
In C++, a number x= 367.1234444444444444444. I only want to get x=367.123 or x=367.1234 (some digits after the sign “.”) Which function to get it?
Thank you in advance.
Pedro
CharlesPandian
Keymaster
If you mean to print something in console, then you may use
fprintf(stderr, "n%4.3d", x);