• We want to write a piece of code that helps these guys out, so I'm going to show you an example.

    通过写一段代码,来解决一个这样的问题,接下来让我们来看个例子。

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

  • That is if I can write code that would solve all instances of smaller size strings, then what I just described isPalindrome will solve the larger size one.

    然后我会描述如何处理大字符串,事实上这正是我所做的,我希望你能看看这边的这段代码,就是这个。

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

  • You write the source code, the stuff that looks like this and then you save your file, and now you just have a text file.

    比如你们写出像这样的源代码后,保存,你将会得到一个文本文件。

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

  • And we hope that at the end of the class, every time you're confronted with some technical problem, one of your first instincts is going to be, "How do I write the piece of code that's going to help me solve that?"

    并且我们希望到了期末,每当你要面对一些,技术问题的时候,你们的本能之一将会是:,“我怎么才能编写一个代码,来帮我解决这问题?“

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

  • You need to be able to read that code and understand it as well as write your own.

    你需要有能力,像编写,解读并理解那些代码。

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

  • Which is a way of reminding you that I need to think as I write the code about what are my expectations from the input, and how might I enforce them.

    通过这个我在提醒大家,在写代码的时候,要搞清楚对输入的期望,并思考下如何执行这些期望。

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

  • You want to write the specs so that everybody does in fact know what this piece of code is doing, and you're writing it each time around.

    但是你得养成良好的习惯和编程风格,你得撰写规范说明从而保证,每个人都知道这段代码是干什么的。

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

  • > So for anything that's not printf, you have to write out code?

    >,对于不是打印输出的,你需要写出代码吗?

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

  • Once you hear that description, it's easy to write the code, in fact. This is a place where the recursive version of it is much easier to think about than the iterative one.

    实际上一旦你听到了大致描述,就能很轻松的写出代码来,在这一点上应用递归来解决问题,比用迭代要容易理解多了。

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

  • First one, when I write a piece of code, especially code that has branches in it, when I design test cases for that piece of code, I should try and have a specific test case for each possible path through the code.

    第一点,当我们写代码的时候,尤其是一些含有分支语句的代码的时候,当我为这些代码,设计测试用例的时候,我应该为每一个可能的程序路径,都设计一个特别的用例。

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

  • And in particular, if I think about that problem - actually I want to do this- if I think about that problem, I'm going to write a little piece of pseudo code.

    关于这个问题尤其要注意的是,实际上当我考虑这个-,问题的时候我想这么做,我会去写一点伪代码。

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

  • How do I write a piece of code for that?

    我该怎么写这块代码呢?

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

  • And that's so you can write small pieces of code.

    这就是你可以编写短小的代码。

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

  • I'm given an integer that's a perfect square, and I want to write a little piece of code that's going to find the square root of it. All right so I'm cheating a little, I know it's a perfect square, somebody's given it to me, we'll come back in a second to generalizing it, so what would the steps be that I'd use to walk through it?

    完美平方数的整数,我想写一段代码来求这个数的平方根,好,我这儿有点儿作弊了,我知道这是一个完美的平方数了,他们给我的,我们后面会讲怎么产生这个数的,那么我想解决这个问题,需要什么步骤呢?

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

  • In the case of last year we did hand students some code with which they could write programs that talked to Yahoo Finance, finance.yahoo.com, free website.

    在去年的情况下,我们给学生提供一些,能用来写程序跟雅虎财经的免费网站交互的代码,即finance。yahoo。com,一个免费的网站。

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

  • So really, the rule of thumb if you think back to Scratch is -- that any time you write a statement -- -- something that does something in one line of code -- you generally need the semicolon there.

    实际上,根据经验,你们回忆一下在Scratch中,任何时候你们写一条语句-,处理一些操作的一行代码-,你们通常需要在那里加个分号。

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

  • OK, so how can I code this up? Well, you might think, let's just jump in and write some code, I don't want to quite do that though, because I want to show you another tool that's valuable for thinking about how to structure the code, and that is a something called a flow chart. Now.

    好,那么我怎么把这个以代码实现呢,你可能会想,让我们进去直接写代码把,但是我不想这么做,因为我想教给大家另外一项很有价值的,用来组织代码的工具,叫做流程图,现在,像Guttag教授,和我这么大岁数的人。

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

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

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

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