So what I'm going to do, well, let's get rid of this print statement for now.
所以我想要做的,好吧,让我们先省去这个打印声明。
So I simply print, highlight, and give a big "X" and a zero.
我会简单地打印一下,标记出来,然后打一大把叉,给个零分。
If you scroll back up on the printout or screen here, you'll see that you can actually not only declare function's prototypes, their general structure.
如果我回滚到打印输出或者这个屏幕,你们将看到你们不仅可以声明函数的原型,它们的一般结构。
And the third thing I need to decide is how do I combine? You know, point out to you in the binary search case, combination was trivial. The answer to the final search was just the answer all the way up.
第三个问题是我需要决定如何进行合并?,就你们所知的,在二分查找中所打印出来的,合并的过程是非常简单的,最后查询的结果,就是一路上来所以的结果。
And this is something you could print out to look at.
你们可以把这部分打印出来看。
Then when you're done you print the page, and we have a special instruction for that in just a moment, and then you'll have what you need for the concept sheets.
当你完成的时候,请把这页打印出来,我们马上会对此做出详细说明,这样你就得到了写观点报告需要的材料
I'm then printing bracket one, bracket two, bracket three, bracket dot, dot, dot up until the total number of arguments, 1 whatever that may be, and it's going to be at least one because the program always has a name.
然后我打印,括号等等等,知道打印完所有的参数,不管那个最大值可能是什么,它将至少为,因为程序总是有一个名字。
Pulling this lever or pushing the button would actually rotate the paper enough so that you'd be on a new line and it would also move the little imprinting head that prints the letters of the alphabet and such all the way to the left.
拉杆或按下按钮会让纸翻一下,这样你就能在新的一行上打字了,同时移动打印字母的,压印头,这样也能移到最左边。
The compiler is going to ignore all of this so-called "pretty printing" -- all of this sort of indentation, -- all of this white space -- that's really for the human's benefits, both yours, your colleagues, the teaching staff, and the like.
编译器会忽略所有的叫做,“优美打印“--所有的这类缩进,所有的这些空格-,只是为了我们的利益,也是你的,你的同事,教员的和其他人的利益。
OK, what I would like you to see is I've been printing out, as I went along, actually let's back up slightly and look at the code. There's merge sort.
好的,我想让你们看就是我运行过后,打印出来的结果,我们再回头看一下这段代码,这就是归并排序,输入一个列表。
No new line just 'cause I made an aesthetic call that this looks kinda nice if the prompt stays on the same line.
基于美学等原因,我们就不换行了,让将要打印出的东西跟在其后。
A progress bar is not supposed to print one hundred lines just to update its status; generally we like to see a little animation.
一个进度条不应该是打印100行,只是更新它的状态,一般地,我们,想看到一点生机。
Let's do a little Copy Paste down here so I can print out its size.
让我再做个复制粘贴,所以我能打印它的大小。
> >> David: F, c because I want to tell printf, "Use these values in those placeholders, these values in those format strings."
>,【无法辨认的声音】,>>,大卫:“f,c“因为我想告诉printf,“在那些占位符,和那个格式下打印这些值“
I print out -- and this is only wrapping - because of the big font -- I print out, "I demand that you give me a positive integer."
我打印出来--这个字符相互覆盖了,因为用的是大字体-,我打印:“我需要你给我一个正整数“
OK. So if I look at this code, first of all I'm calling search, it just has one call, so looks like search is constant, except I don't know what happens inside of b search. So I've got to look at b search.
首先调用一下搜索,就一步调用,看起来搜索是固定的,除非我不知道二分搜索的原理,那我们来看看二分搜索吧,所以让我们看看,第一行打印出来的内容。
And it takes the set of stocks to simulate, a fig, figure number, this is going to print a bunch of graphs, and I want to say what graph it is, fig mo and whether or not I believe in big mo.
我们需要一些股票才能进行模拟,很多很多的股票,我们会打印一些图,然后我会告诉你们这些图是什么意思,或者我们看到这个。
When I ran it up here, with the old Fib, and we printed the result, and I ran it with Fib 1 down here.
当我运行到这里,也就是老的Fib函数,我们打印这个结果,当我在下面调用Fib1时,也打印了结果。
OK. It simply doesn't print anything.
好了,它只是不会打印任何结果而已。
It'll print, I think, 85 calls.
我想它会打印出85次调用。
With all those print statements.
打印声明也是相同的。
So it's printing a lot.
现在打印了很多了。
Now, I'm using this thing.
如果我们不是打印别人已经写好的东西。
I'm again, saying print argument's new line.
我再次指明,打印参数的新行。
> Print the answer.
>,打印答案。
Just iterates from zero to Arg C. The indented line here print F is clearly printing a string, as per the percent S, but what is it printing?
只是从零开始迭代,到ArgC,这个缩进行printf显然是打印一个字符串,就像每一个%s,它在打印什么呢?
This is copy2.c. At the very beginning I, again, demand say something and then I declare s1 to be a string, aka char *, and I store in s1 the string the user types in.
这是copy2。c,在开头打印一句话,然后声明s1是一个字符串,也叫做char,*,然后把用户输入的字符串存储在s1中。
Remember last time, we wrote this simple piece of code to print out even or odd. If, you know, x, 1 it was in fact, even or odd. So let me show you what a flow chart for that would look like, because I want to make a comparison point here.
这就像这里有一些脚蹼一样,首先进行测试,然后把球这样放来让ANS加,然后回来继续测试,最终跳出循环然后打印答案。
So it turns out with printf you can actually control those kinds of aesthetics as well.
所以我们用printf也可以控制这种,打印结果的美观性。
We began here so at this point in the story the next thing that's going to happen is this line called Print F that says swap exclamation point, right?
我们从这里开始,在这里,下一步将要发生了的事情是,这行叫做printf的代码,打印:“交换完成!“对不?
应用推荐