• What happens now after we've executed this third line of code, what happens next in the story?

    我执完第三代码会发生什么呢,在这之后会发生什么呢?

    哈佛公开课 - 计算机科学课程节选

  • But if I did have two lines of code or more, I would in fact need to put those back.

    但是如果我的确有两或更多的代码,我其实应该把花括号加上。

    哈佛公开课 - 计算机科学课程节选

  • Imagine instead, you're writing code that's a hundred thousand lines, a million lines, of code. You don't want to write it in this form. All right, and the reason you don't want to do that is, well, several.

    换一个角度来思考,你正在写的代码有几十万,近百万,你绝对不想写成这种格式,好吧,你不想这么做的原因有以下几个。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • I'm gonna zoom in a little more and notice it's pretty much 1, 2, 3, 4, 5, 6, 7, 8, 9 lines of code and that's kind of rounding up because of the white space.

    我现在放大一点,大家会看到,2,3,4,5,6,7,8,9代码,多亏了空格,这些代码才能看起来如此美观。

    哈佛公开课 - 计算机科学课程节选

  • At least you maybe finding that and if not when you look back at the code you then have written you'll realize that in fact it just requires a few lines of code.

    至少你会发现这一点,不然的话,在你写完代码,返回去,看的时候你会意识到,实际上它只需要几代码

    哈佛公开课 - 计算机科学课程节选

  • Delete those lines of code and move them up to the top and problem solved.

    把这几代码删除,然后把它们放到,前面去,问题就解决了。

    哈佛公开课 - 计算机科学课程节选

  • You can imagine having many lines of code where all of a sudden your closed quote is on the next line all the way on the left.

    你可以想象一下,这有很多代码,突然一个后引号,移到下一最左边。

    哈佛公开课 - 计算机科学课程节选

  • So in your mind, if you are now the computer program and you are executing this thing from top to bottom, what just has happened verbally is we are stepping into the line of code that says sort left half of elements.

    在你们看来,如果你现在是计算机程序,正在从上到下执一系列指令,刚才所发生的就是我们现在已执到了这代码,它告诉你要对左半部分的元素排序。

    哈佛公开课 - 计算机科学课程节选

  • The curly braces to encapsulate one or more lines of code.

    花括号压缩了一或多代码

    哈佛公开课 - 计算机科学课程节选

  • And now in a sentence, what does this one actually do?

    现在在句子中可以看出,这代码做了什么?

    哈佛公开课 - 计算机科学课程节选

  • So we'll try and go in the middle of that.

    现在我们还有剩下的六代码

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • In fact, this example would compile because you can use curly braces in this way to encapsulate lines of code, but realize for now, that, not good.

    实际上,这个例子可以编译,因为你可以用这种方式来压缩代码行,但是请认识到,那个,不太好。

    哈佛公开课 - 计算机科学课程节选

  • And so at the end of the day, a hundred lines later, it should get to one hundred percent.

    所以,最终,100代码之后,它将100%完成了。

    哈佛公开课 - 计算机科学课程节选

  • It ultimately evaluates that line of code but just once the stuff inside the curly braces, but the semicolon on the end, essentially has the effect of this.

    它最终执了那代码,但是只有一次,当那个东西在花括号里,分号放在后面,本质上影响了这个循环。

    哈佛公开课 - 计算机科学课程节选

  • And then what I get to do inside the curly braces is literally line by line enumerate the cases that I want to apply to the following code.

    然后我们在花括号中要做的是,逐地列举接下来我想要,应用的代码

    哈佛公开课 - 计算机科学课程节选

  • s1 It's a little square, it's going to be called s1 and that's what exists as of line two of this program, GetSting but now I've called get string.

    这是一个正方形,叫做1,这就是程序中第二代码所表示的,现在我调用。

    哈佛公开课 - 计算机科学课程节选

  • So, I'm getting a string and so what really am I doing in this line of code?

    那么,我得到一个字符串,这代码实际上是干什么的呢?

    哈佛公开课 - 计算机科学课程节选

  • And when I'm starting to write lots of lines of code, you know, it's frankly kind of useful to be able to see more on the screen at once without having to scroll.

    当我开始写很多代码的时候,你们懂的,这明显是有用的,当你可以在屏幕上看到更多的代码,而不用滚动屏幕。

    哈佛公开课 - 计算机科学课程节选

  • So we just zoomed in on this line of codes.

    我们放大这代码

    哈佛公开课 - 计算机科学课程节选

  • Ten lines of code. Twenty lines of code.

    用10来代码,20来代码就可以。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • Most folks at least have something along those lines.

    至少大部分人有一些东西沿着那些代码行

    哈佛公开课 - 计算机科学课程节选

  • Because as you'll soon find, when you're writing programs 0 that aren't just four lines long but are 40 or 400 which very quickly becomes easy, you'll find that even you the next morning have no idea what this code does for whatever reason, and just having some English comments is a huge boon to comprehension for yourself and others.

    你们自己写程序时就会发现,用40甚至400代码来代替繁杂拥挤的4代码0,将会让事情简化许多,你会发现,即使由于某些原因,你不知道如何写代码,先写些注释,于人于己,都是好事,易于理解嘛。

    哈佛公开课 - 计算机科学课程节选

  • So input is an int called F, print out to the screen or your piece of paper the value of C. Odds are you only need two, maybe three lines of code for this, but the goal ultimately will be try it on your own.

    所以输入是一个int类型的F,在你的屏幕上,或你们的纸上打印出C的数值,可能你们需要两或者三代码,但是最终的目标需要你自己独自尝试。

    哈佛公开课 - 计算机科学课程节选

  • And the reason that we now on the second line have the equal sign is because this function GetString has what's called a return value.

    我们之所以,在第二代码GetString前面加上等号,是因为这个函数会带回一个,返回值。

    哈佛公开课 - 计算机科学课程节选

  • So, after the second line for code here char * s1 gets the return value of get string this is what the state of our world looks like.

    在第二之后,这个代码char,*s1,等于GetSting的返回值,这就是它看起来的状态。

    哈佛公开课 - 计算机科学课程节选

  • 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的代码,打印:“交换完成!“对不?

    哈佛公开课 - 计算机科学课程节选

  • So this line or these lines of code up here are arguably constant time steps to say if N is less than 2 in return, that it will always take maybe one step, maybe two steps, some number of fixed CPU cycles.

    如果N小于2并返回,那么这些所对应的代码,通常只需要执一步,或者两步,具体数字与CPU周期有关。

    哈佛公开课 - 计算机科学课程节选

  • So the very last two lines of code I'm saying this, s2 the original string is s1, the copy of the string is s2, but if I haven't lost you, what are we really going to see when we print this?

    最后两代码是这样的,原字符串是s1,那个字符串的拷贝是,但是如果我没有忘记,当我们打印的时候,我们将看到什么?

    哈佛公开课 - 计算机科学课程节选

  • But what looks like this orange block as of now in Scratch, add orange to your so called inventory, well, it's gonna take at least two lines of code in C to actually create the inventory array with this first line and then put something like the word orange inside of it.

    就好比Scratch里面橘色的这一块,把“桔子“加到所谓的“清单“里面去,在C语言中至少需要两代码来实现,第一代码创建一个货单数组,第二就需要把“桔子“放进去。

    哈佛公开课 - 计算机科学课程节选

$firstVoiceSent
- 来自原声例句
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定