In the example I just wrote here, this is pretty trivial, right. OK, I'm trying to input floats.
在我写的这个例子中,这是很微不足道的。
So, this is what goes on in an electrolysis cell, and it works thanks to input energy from a power supply shown here.
所以,这是在一个电化学电池中发生的,它是靠输入的能量工作的,从和这个类似的电源输出的能量。
The only thing I've done in this part of the program, now I'm going to go and read the code, is I've gotten the user to input a bunch of data.
现在我去读读这里的代码,是我会让用户输入一些数据,然后根据用户输入的数据。
No, instead we have to click other amount at bottom right there, when we have to input 4-0-0 in this screen 4-0-0 after consulting visually the little cheat sheet on the device itself it tells you in a very long chart how much one pass costs so we multiply and type in 4-0-0, we hit enter.
不,然而我们必须点击,右下边的这个,当我们需要在这个屏幕上,输入0,通过咨询那个设备上小说明,它在一个很长的图表上,告诉你,每一站需要多少钱,我们加起来,输入了4-0-0,点击输入。
get back to the initial point is going to require some input from outside, like heat or extra work or extra heat or something because you've done an irreversible process.
如果要逆转它,回到初始点,就需要外界的投入,比如额外的功,额外的热量等等,因为你进行了一个不可逆过程。
So the body breaks and no longer is able to give input up to the soul.
由于肉体死亡了,它将不再给灵魂输入指令
Need to get the base in. Second thing I want to do, I need to get the height, so I'm going to input a value for the height, also as a float, a floating point.
也就是输入底的值,第二件我想要做的,事情就是得到三角形的高,因此我会输入一个值作为三角形的高,同样也是一个浮点数。
ReadFloat We'll look at it in a second. Let me sort of set the stage up for this -- suppose I want to input -- I'm sorry I want you as a user to input a floating point number.
名字叫,我们来看一会,我先来设置下情景-,假设我想输入,抱歉,我希望你们作为用户来输入一个浮点数。
So if I were to solve this problem, here's the way I would do it. I would say, first thing I want to do, is I want to input a value for the base as a float.
如果我想要解决这个问题,这就是我要解决它的方式了,第一件我要做的事情就是要,输入一个浮点数作为三角形的底。
We own our own phone number, that allows you to input key strokes like you would any system and this is an example of what we call CS50 Voice.
我们都有电话号码,这就让我们可以输入任意的数字,然后这是CS50,Voice的一个例子。
Suppose you could build a circuit with the following property: the input to this circuit would be any other circuit diagram.
假设你能用如下物品,建立起一个线路:,这个线路的输入设备,可以是任意一个其他线路的流程。
It could be, preconditions I want to have on input It could be, explanations of specific things you're doing.
也可以是我对输入的预期是什么,也可以是,对代码,正在进行的特定操作的解释。
Obviously the algorithm is likely to depend on the size of the input, so this is not a great idea.
很明显这个算法是与我的,输入的大小相关的,因此这不是个好方法。
It was a complete waste of time, unless the goal in life was simply to pester the user for some input.
刚才的时间就完全浪费了,除非那个唯一的目的,是简单地纠缠用户索要一些输入。
And by that, I mean, not how much memory do I need to store the size of the input, it's really how much internal memory do I use up as I go through the computation?
需要占用多少内存,我意思并不是,存储输入需要多少内存,而是当我完成这个?
If I decide there's a better way to get input, and there is, then I can make it to change what I don't have to change the code that uses the input.
如果我觉得有更好的获取输入的方法,我可以直接改去用这种方式,而不用更改使用了,输入处的代码。
We're going to build up this taxonomy if you like, but the reason it's relevant is, associated with each one of those types is a set of operators that expect certain types of input in order to do their job.
我们将会建立这种分类,但是这相关的原因是,对于每种类型都有,和之对应的一个操作集,这个操作机对一些输入,做出规定的操作。
Now in this case, it's clear that I'm not only saying this function takes an input, I also have to give that input a name.
在这种情况,很清楚的,我不只是说明这个函数有一个输入,我还要给那个输入一个名字。
I'm going to run through a loop, and I'm going to request some input, which I'm going to read in with raw input.
我要运行一个循环,我需要一些输入,需要读入一些原始的输入。
For a couple of reasons. In some ways, this would be nicer, do expected cases, it's going to tell you on average how much you expect to take, but it tends to be hard to compute, because to compute that, you have to know a distribution on input.
关注最快的情况,在某种意义上来说,因为一些原因这样想挺不错的,当我们处理一个给定的问题,计算平均时间的时候,是很难计算的,因为你并不知道输入的分布情况,这些输入会是怎么样的呢?
You have to pass it as input to another function, as you'll see as possible in problem's Set One specification, but it's ultimately up to you.
你需要把它传给另一个函数当入参,就像你们将,在习题集1中可能看到的,但它最终取决于你。
Because if I don't specify a name for this input, I have no way of actually referring to it in subsequent lines of code.
因为如果我不给这个输入定义一个名字,在随后的代码中,我就没有办法使用它。
It then should take an argument or parameter if you want your function to take input.
然后它必须携带一个参数或参量,如果你想要你的函数获得一个输入。
We've been using strings thus far to get input from user and store it in variables.
迄今为止,我们用字符串来接受用户的输入,然后存储在变量里。
STUDENT: So, how do you come to a conclusion as to which you should use then, if you can determine the size based on solution, or based on input, so how do you decide?
学生:所以,你怎样决定你该用,哪个来算呢?现在如果你可以选择是,基于解决方案的大小,还是基于输入的大小,你应该怎样决定呢?
I need a contract that says, here's what I want in terms of things that you're going to take as input, to begin your part of the drama, here's what you're going to produce at the output, and the details of what they do inside are up to them.
这些作家相互沟通进行工作呢?,我需要一封规格说明书,我需要一份合约,上面列出了我想要你做的事,这些是你要再开始时做的输入,这些是你要的输出,细节工作就取决于它们了。
What does it expect as input, and any other information I want to pass on.
但是如果我去做了,我将要说明这个函数是干什么的。
And its purpose in life is to maybe take input and maybe produce output.
它的唯一目的是可能是获得输入,可能是输出东西。
As I said, what we want to do is, we want to count the number of basic steps it takes to compute a computation as a function of input size.
我刚才提到了,我们要建立,一个根据输入大小的方法来计算,一个计算过程需要的时间,建立这个方法需要几步呢?
应用推荐