F Then I'm going to print a capital F just % 1f C to be aesthetically interesting equals another %.1fc.
然后我将打印大写字母,使其比较美观的,等于另一个。
And that's probably useful if you're actually trying to format things in a nice way.
这个可能有用,当你想把它的格式,变得美观一点的时候。
I'd like an integer please, a colon, and a space just for aesthetic reasons.
我想要一个整型数,一个冒号,和一个,使其更美观的空格。
So it turns out with printf you can actually control those kinds of aesthetics as well.
所以我们用printf也可以控制这种,打印结果的美观性。
Let me go ahead and call print F. I'm going to say A equals A and then I need a percent D, backslash, comma A; so this is a little bit of -- more syntax than would be nice, %d but I'm just saying, literally, A equals percent D, and I'm plugging in the value of A for percent D.
我们继续调用printf,我说明A等于,然后我需要%d,反斜杠n,逗号;,所以这个有点--偏向逻辑的,而不偏向美观的,但是我刚说了,字面上,A等于,我用%d插入了A的值。
应用推荐