much better
thanks
much better
thanks
what mean this part of the printf
there is %05.5fCode:%05.5f, "
whats that?
and there is a space after a comma
what this thing does?
Look up format specifiers in your textbook, there under printf. Everything else in the quotes just gets printed normally. (The last quote is just the end of your quotes.)
i cant find stuff on that
i looked in the formal
http://www.cplusplus.com/reference/c...io/printf.html
i cant see there this %05.5f, " stuff
Since it is listed there at the top of the page, that's a problem.
f Decimal floating point
0 Left-pads the number with zeroes (0) instead of spaces, where padding is specified (see width sub-specifier).
(number) Minimum number of characters to be printed. If the value to be printed is shorter than this number, the result is padded with blank spaces. The value is not truncated even if the result is larger.
.number For e, E and f specifiers: this is the number of digits to be printed after the decimal point.
Here's a tip, when somebody does get some advice wrong, there will probably someone posting to to correct them fairly promptly.
If a post has gone unchallenged for a while, and is even backed up by someone else, it's a pretty safe bet that it's correct.
If you suspect some advice was incorrect, just ask for someone else to confirm.
My homepage
Advice: Take only as directed - If symptoms persist, please see your debugger
Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"
so the first 5 means that we need to print at least five chars in this float number
and the second 5 means to print the float number in persition 5 place after the point
??
Read it again:
There will be five digits printed after the decimal point..number For e, E and f specifiers: this is the number of digits to be printed after the decimal point.
it says there
%[flags][width][.precision][length]specifier
but in my printf i get the flag at the last place
??
Eh? Your flag was 0, your width was 5, your precision was 5, you didn't have a length, and your specifier was f.
can you rephrase this line
"0 Left-pads the number with zeroes (0) instead of spaces, where padding is specified (see width sub-specifier)."
i cant understand the meaning of this padding thing
?
If we use %d as an example:
would produce the output of:Code:printf("%5d\n", 123); printf("%05d\n", 123);
So in the first example, it gives you spaces to make a length of five, in the second case, it uses 0 to fill the length.Code:123 00123
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
so when there is no char between the % and 5
it put blank spaces?
C programming resources:
GNU C Function and Macro Index -- glibc reference manual
The C Book -- nice online learner guide
Current ISO draft standard
CCAN -- new CPAN like open source library repository
3 (different) GNU debugger tutorials: #1 -- #2 -- #3
cpwiki -- our wiki on sourceforge
Can I just recommend that you read a book? There are some fine pieces of programming literature recommended on the thread aptly entitled C Book Recommendations.