Answer the question
In order to leave comments, you need to log in
C++ How to print numbers after the decimal point, discarding the integer part?
I'm new, I'm asking for advice. I have variables:
S - number of type double , which is accepted from the user;
N - ( unsigned int ) the number of numbers after the decimal point, received from the user, that need to be displayed by discarding the integer part and making it an integer.
That is, we have numbers, let's say S = 245.23578 and N = 4 , The output should be = 2357 .
How to do it right? I looked at modf , it doesn't fit, because the number is displayed as 0.235780 .
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question