printf And then I'm gonna use the same printf line after that to actually plop it into this formatted string.
我还是要用到,来把它转换成格式化字符串。
You could absolutely implement something more interesting and something even more animated like we saw on Wednesday or even earlier today, but it takes a little more than just a format string.
你绝对可以实施一些更有用的,和一些更愉快的东西,像我们周三或今天早些时候,看到的,但它不只是,格式化字符串。
We're talking complete irreversible amnesia, complete erasure of the brain's hard drive.
就像是完全不可治的健忘症,完全将大脑这个硬盘格式化。
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.
基于这是某人多年以前写的程序,最终的结果是打印出这个,这个,在格式化字符串中间的,然后返回结果。
Good question, so what happens when you format a floppy disk or format a hard drive?
好问题,当你格式化一个软盘,或者硬盘时会发生什么呢?
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.
看下这个底部,这个是相当随意的,但我选择把我的字符串格式化成这样:,所以在这个底部我打印输出,提醒一下,这是一个只打印出,小数点后一位的方法。
They came formatted or blank so not such a big deal.
它们被格式化了或者是空白的这并不重要。
And so this is why in problem set 5 last year when I took photographs on campus with a compact flash card, just standard consumer media and I accidentally formatted that compact flash card, I only lost the first few kilobytes, the first few thousand bits on that compact flash card.
这也是去年的套题5中,我们在校园里面用配有,简易闪存卡的标准摄像机拍照片,我不小心格式化了这个简易闪存卡,其实我只是丢失的最开头的几千个字节的数据。
So these format strings we saw earlier.
比如之前看到的格式化字符串。
> 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类型这样的变量,那样我就可以把它打印出来,像是格式化优点的插入值。
But if you avoid all of these minutia and focus really just on the idea, it looks like what was a blue say block, a so called statement, is now going to be something called printf where the F happens to stand for formatted.
但是如果你抛开所有这些繁琐的细节,把注意力集中到,它的编程思想,那么它只不过一个蓝色的say程序块,是一个声明,即所谓的printf函数,其中的f是,用于格式化输出。
Well, here is the F in printf for formatted printing.
这里printf中的f是用于格式化输出的。
应用推荐