The reason I'm going to show you this flow chart, I'm going to do one other example in a second, but I want to show you a comparison.
我稍后还会给大家讲另外一个例子,我给大家看这个流程图的原因,是我想给大家一个对比。
So here's a simple flow chart that I'm going to use to capture what I just described.
就和我刚才描述的一样的流程图,然后我会,再说一次,我实际上和他们原来。
Well according to one school of thought ; there isn't anything particularly revolutionary about monotheism; and the classical account of the rise of monotheism, that has prevailed for a very long time, runs as follows, and I have a little flow chart here to illustrate it for you.
曾经某个思想学派告诉我们,一神论其实没有什么独特的新颖之处;,而它却能飞速崛起,备受重视,盛行了很长一段时间,正如我下面要提到的,我这儿有一些图来帮助你们理解。
I can either look at my flow chart, or I can look at the code. If I look at the flow chart, it says, I'm at this point. Look at ANS squared. Is it less than or equal to-- sorry, first of all, 0 ANS squared is 0, is it less than or equal to x, yes.
我可以看流程图也可以看我的代码,如果我看流程图的话,流程图这么说的,在这一点,看看ANS的平方,看是不是小于等于-对不起,首先,ANS的平方是。
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加,然后回来继续测试,最终跳出循环然后打印答案。
Remember last time, we wrote this simple piece of code to print out even or odd. If, you know, x, 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.
记得上节课我们写过的,那个显示奇数还是偶数的程序么,如果,你知道,x,实际上是奇数还是偶数,那么让我来为大家画个这个程序的流程图吧,因为我这里想为大家做个比较。
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教授,和我这么大岁数的人。
I test an end test. So the flow chart says, and the tradition was to do this in a diamond shape, I'm going to check if ANS times ANS-- oh, which way did I want to do this x - is less than or equal to x. Now that's a test.
首先进行终结测试,因此流程图就的去,传统的做法是把这个放到一个菱形里面,检查下是否ANS乘以ANS-哦,我刚才是怎么说的来着-是不是小于等于。
应用推荐