• But if it is not, it's going to print out a message here saying, you screwed up, somewhat politely, and it's going to go back around. So it'll just cycle until I get something of the right type.

    但是输入不是浮点数的话,我这里就会显示一个消息说,你搞砸了,该稍微有点礼貌吧?,然后我们继续执行循环,一直到得到正确类型的输入。

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

  • And I want to remind you, that block of code is a set of instructions, the same set of instructions that are going to be done each time through the loop.

    我想提醒大家,这块代码是一个指令集,一个每次循环都会被执行的相同指令集,会变化的仅仅是变量的值。

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

  • If so, proceed to loop."

    如果是,接着执行循环

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

  • Otherwise the test is always going to be true, we're going to go off here, but this would loop forever if I did that.

    否则测试结果就会一直为真,我们需要离开这个测试,否则就会一直执行循环

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

  • Now I have the ability to create a loop, that is, to reuse the same pieces of code over and over again as I go around.

    现在我们已经学会如何创建循环了,也就是,重复的一遍又一遍的,执行同一片代码。

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

  • The inner loop, this part here, I do m times.

    这个循环执行了多少次呢?

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

  • How many times do I go through the loop?

    那我执行了多少次循环呢?

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

  • It's running through a similar set of loops.

    执行的是相似的一套循环

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

  • Now this happens to be what we would call a linear process, because the number of times I go around the loop is directly related to the size of the argument. If I double 2 the argument, I'm going to double the number of times I go around the loop. If I increase it by five, 5 I'm going to increase by five the number of times I go around the loop.

    这恰好是我们会成为,线性复杂度程序的一个例子,因为我要执行循环的次数是,和输入的参数的大小直接相关的,如果我将这个参数乘以,那么我就要将进行循环的次数也乘以2了,如果我把参数加上,那么循环的次数也要加上5了。

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

  • Sorry? OK. You're doing the whole thing for me What's the complexity just of this inner loop m How many times do I go through that loop?

    就这一块代码的,我执行了多少次这个循环?,次对不对?,here?,Just,this,piece。,我一会儿就会去得到你的答案的?

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

  • At the end of the day, you can implement the exact same program using a while loop that you can using a for loop, it's just your code is going to look slightly different.

    最终,你可以执行这个程序,再使用for循环的地方使用while循环,这只是使你的代码看起来稍微有点不同。

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

  • So conceptually the key difference here, besides the syntax looking slightly different, it just means that if you want a chunk of code to execute no matter what initially, ; you can use the do while loop; if you want to check a condition first, you can use the while loop.

    所以概念上,则关键的区别是,除了语法看起来有点不同,它的意思是如果你想要一段代码,最初无论如何都要执行,你就可以用do,while循环;,如果你想要先检查条件,你可以用while循环

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

  • Because I keep counting down each time around-- mostly I've got to unload this candy which is driving me nuts, so-- thank you.

    因为我每次循环b减了,我一共要执行这个循环b次,所以这里我们一共执行了3b次基本操作。

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

  • And then I run a loop in which I read something in, I check to see if it's the right type, if it is, I change that variable to say it's now the correct type, which means the next time through the loop, I'm going to say I'm all set and I'm going to bounce out.

    因为我还没输入,然后我运行一个循环,循环内部我输入一些东西,然后看看是不是正确的类型,如果是的话我改变input,Ok为真,来证明输入数是正确的类型,这就意味着下一次运行这个循环的时候,就可以跳出循环继续执行了。

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

  • b times. So I've got to go 3 b steps. All right I've got to go through the loop b times I've got three steps each time, and then when I pop out of the loop, I've got two more steps. All right I've got the initiation of answer and the return of it.

    好,我一共执行了b次循环,每次循环内部进行了三次基本操作,当跳出循环后还有两个基本操作,因此这个初始的答案就是,2+3b次基本操作,来完成这个循环

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

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

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

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