So the end result, because someone wrote this function years ago is that printf takes this thing, takes this thing, David plops David inside the middle of that formatted string and then renders the whole result.
基于这是某人多年以前写的程序,最终的结果是打印出这个,这个,在格式化字符串中间的,然后返回结果。
Glancing at the bottom, this is pretty arbitrary, but I chose to format my string as follows: % 1f so at the bottom here I'm printing out %.1f, which quick sanity check means print just one digit after the decimal place.
看下这个底部,这个是相当随意的,但我选择把我的字符串格式化成这样:,所以在这个底部我打印输出,提醒一下,这是一个只打印出,小数点后一位的方法。
> >> David: F, c because I want to tell printf, "Use these values in those placeholders, these values in those format strings."
>,【无法辨认的声音】,>>,大卫:“f,c“因为我想告诉printf,“在那些占位符,和那个格式下打印这些值“
> David: At some point in time, I'm going to have to have declared the variable as a float before I can then hand it to printf as the insertion value for that format strength.
>,大卫:在一个特定的时间,我将需要,声明float类型这样的变量,那样我就可以把它打印出来,像是格式化优点的插入值。
Now as an aside, turns out you can do more interesting formatting with printf, and this is useful even for ASCII art purposes.
说点题外话,结果你可以用printf来打印其他的格式,这是非常有用的,甚至是为了ASCII艺术的目的。
应用推荐