• Alright, we are back so we just wrote a programming pseudocode or walk through a programming pseudocode.

    继续上课,刚才我们只写了一个伪代码,或者说简单地过了一下。

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

  • And for reference, incidentally, in case you ever forget what the point of some exercise was, I'll almost always comment the code up top with a quick sentence or two that reminds you what this program does.

    顺便作为参考,为了避免我们可能忘记一些代码的意思,我通常会用一两个简单的句子,在上面作出注释,那样会提醒我们这个程序是干嘛的。

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

  • And that then let's me get to, basically, base this code. Having done that, height I simply call base with get float, I call height with get float, and do the rest of the work.

    现在让我们看看这段代码,其实已经写好了,我简单的调用下,用来得到一个浮点数,再调用下,来得到另外一个浮点数,然后做剩下的工作就可以了。

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

  • But I want to stress again, as long as I do the base case right and my inductive or recursive step reduces it to a smaller version of the same problem, the code will in fact converge and give me out an answer.

    就开心的去做吧,但是我想再次强调,只要基础事件处理正确而我的递归,或递推步骤能把它简化为更简单的同类问题,那么这段代码就可以收敛。

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

  • And I think this is best illustrated by giving you a simple little piece of code.

    我认为给你看一段简单代码,可以很好的说明这个问题。

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

  • I will tell you that a good programmer, at least in my mind, may actually go back and modify the pseudo code as they realize they're missing things, but it's easier to do that when you're looking at a simple set of steps, than when you're in the middle of a pile of code.

    至少我认为是这样的,如果他们发现遗漏了,一些步骤的话会,回过头去修改伪代码,但这当你面对一些大致的步骤时,这个过程就会比,面对一堆代码简单的多。

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

  • It's basically cycling through the loop a multiplying by a each time.

    这个代码就是简单的循环,每次乘一个。

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

  • And if you're sharing a particularly decent amount of code, you should definitely submit it as private, or if easier, you can email help at cs50.net.

    当你分享了一些相当好的代码量,也可以私下提交,或者更简单点,发邮件到cs50,net寻求帮助。

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

  • Remember last time, I said that there's different kinds of complexity in our code, and I suggested for simple branching programs, the amount of time it takes to run that program is, in essence, bounded by the number of instructions, because you only execute each instruction at most once.

    但是这里有个很重要的点,记得上节课,我提过在我们的代码中,有不同种类的复杂度,而且我还说了对于简单的分支程序,运行这种程序需要的总体时间,大体上,是和指令的数目相关的,因为每个指令只会被执行最多一次。

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

  • I spotted an error here, I could have spotted it by running it on different test sets, and using prints things, another way of doing it, but this idea of at least simulating it on simple examples lets you check a couple of important questions.

    操作么?我在这里发现了一个错误,我也可以通过运行不同的测试集,或者运用print声明来发现这个错误,但是至少应该用简单的例子来手工模拟下,代码的思想可以让你,对一些很重要的问题进行检验。

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

  • You can stack these things in C. So if you want to do if - and then rather -- let me tweak this just so simplify -- if you want to stack these things and do this in one case or that in the other, can you stack them like this?

    你们才可以在C语言中使用这些东西,所以如果你想做,-让我把这个弄得更简单点-,如果你想把这些代码堆集在一起,在一个情况中,或在另一个情况中处理,你能够像这样把他们集在一起吗?

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

  • I think the easiest way to look at what this does, is let's take a really simple example- I want to make sure I put the right things out- I've got a simple little list of values there.

    到底做了什么,就是让它跑一个简单的例子,我想要确信我找到了正确的元素-,这里我用一个简单的小的列表-,如果我去代码里面看。

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

  • That goes back to that idea of sort of discipline coding. It's easy to have assumptions about what you think are going to come into the program when you writ it. If you really know what they are use them as search, but if you think there's going to be some flexibility, you want to prevent the user getting trapped in a bad spot, and exceptions as a consequence are a good thing to use.

    这又回到了规范编码的想法上来了,在你写代码的时候考虑,什么会进入你的代码的思考是简单的,如果你真的知道,他们是用他们来做搜索的,而你希望有一定的灵活性,你想要阻止用户,陷入一个艰难的境地,那么异常是非常实用的。

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

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

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

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