Then, they take that amount and they go over and they type that amount into the credit card terminal.
然后他们拿走了那些钱,检查一下,然后把数额输入信用卡终端机。
the endless grading and inputting data into spreadsheets,
无休止地划分等级,然后把数据输入到电子表格里。
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.
但是输入不是浮点数的话,我这里就会显示一个消息说,你搞砸了,该稍微有点礼貌吧?,然后我们继续执行循环,一直到得到正确类型的输入。
2 2 I can move 9 down, I can move 12 down, I can move 2 down, God and I can cheat by entering God mode and if I hit God and hit Enter well now the problem set solves itself for me.
我可以将9移下来,移动,而且我也可以输入无敌模式,如果我输入,并回车,然后此问题将会自动开始,解决。
The next I knew, she had literally typed my password.
然后她就真的帮我输入了"密码"
What I'm going to ask you to do is track what you're eating, and to go to a website that will allow you to enter all your eating, and then it will print out a dietary analysis of that.
我希望你们能记录每天吃的东西,然后到相关网站输入你的饮食记录,之后打印出饮食分析报告
I could generalize this pretty nicely. Imagine the same kind of idea where I want to simply say I want to take input of anything and try and see how to make sure I get the right kind of thing. I want to make it polymorphic.
对吧,我试着输入浮点数,我能更好的一般化它,想象下类似的想法,我需要输入些什么,然后看看输入的是否正确,我想使他更多元化些。
bug What I typically do is I start with the input that provoked the problem, and I keep making it smaller and smaller.
我这里做的就是从引起,出现的输入开始,然后将输入,一步步的缩小规模。
You notice what it did, it printed out that little, right up here I'd said enter a number and that's what it's printed out, so I can enter a number and it prints it out.
注意这个程序做了些什么,显示出了指定值,然后显示需要输入个数字,然后程序会显示这个数字,我输入一个数字然后程序显示了它。
Now hopefully you're keeping a sheet of paper with you and you're writing down what you eat so you don't forget everything, and then you sit down at your computer at the end of the day and you log it all in.
希望你们可以随时带张纸,以便随时记下,吃的东西以防忘记,然后坐在电脑前,在一天结束时输入电脑
Testing and reasoning. Testing, we run our program on some set of inputs.
测试就是,我们输入一些信息,并且运行我们的程序,然后查看答案。
And if we type directly into the interpreter, it essentially does an eval and a print.
如果我们直接输入到解释器里面,它本质上会运算然后返回结果。
So I predicted what answer I'm expecting to get.
然后我输入我的计划输入到要。
And given those types of input, will get back output.
然后鉴于输入类型返回结果输出。
But there's an important thing going on here, if I in fact wanted to combine those into a string I should have told the machine to do that, and I can do that, by explicitly saying, take that, which is a number, then add it to that string.
但是这里有个很重要的事情,实际上想要把这些加到一个字符串里面去,我应该告诉计算机去做这个,我应该这么做,通过明确的输入,也就是把这个对象,一个数字,然后把它加到一个字符串里面去。
s2 So, I'm passing in the first character in s2, I'm making it uppercase and then I'm putting it back so casually speaking this is just capitalizing the first letter of whatever word the user typed in to s2.
那么,我把第一个字符传递给,我把它转换成大写的,然后存下来,简单说,这就是把用户输入s2中的单词,的第一个字母转换成大写的。
And again, if I just run this, just to show that it's going to do the right thing, it says enter base, I'm obnoxious, it says oops, wasn't a float, so we'll be nice about it and I enter a height, and it prints out what I expected. I just concatenated those strings together, by the way, at the end.
我再来运行下看是不是做对了,提示输入底,噢,它提示说不是浮点数,我很高兴,然后我输入一个,浮点数作为高度显示结果和我预期的相同,顺便说一句,我只是在最后把这些字符串连接起来了。
See, I've defined f of x to be a function x=x+1 that takes a value of x in, changes x to x+1, x and then just returns the value.
我定义了f是一个函数,输入x,让,然后输出。
So STR, which I just typed up there, takes in parens, some input, and it converts it into a string, so that now I can use that John where I was expecting a string. John.
因此STR,也就是,我刚刚输入的,然后把这个输入变更为一个字符串,因此现在我就能,在需要用字符串的地方使用这个对象了。
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的一个例子。
If you instead use GetString, same thing: blinking cursor, the function is just going to wait for the user to type a word, a sentence or whatever, and then hit Enter.
如果你用GetSring来代替它,同样的:闪烁光标,那个函数只是等待用户来,输入一个单词,一个句子什么的,然后敲回车。
Let's go ahead and make conditions2, and hit Enter.
让我们继续输入“make,condition2“,然后敲回车。
We saw, associated with that primitive data, we have ways of taking data in and creating new kinds of data out, or new versions of data out, so we have operations.
我们可以取得输入的数据然后,创建新的类型的输出数据,或者新的版本的输出数据,这就是我们说的操作。
printf I have my includes, standard IO's; so I can use print F, but then I had this thing called a prototype.
我包含了标准输入输出文件,所以我可以使用,然后我有这个原型。
which I just did there, -mystring in fact, let me type it in-- mystring, with an equal sign, which is saying, assign or bind to that name the value of the following expression.
也就是这里我做的,实际上,让我输入,然后是个蹬好,意思就是说,把这个名字绑定到,后面表达式的值上去。
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.
现在我去读读这里的代码,是我会让用户输入一些数据,然后根据用户输入的数据。
We've been using strings thus far to get input from user and store it in variables.
迄今为止,我们用字符串来接受用户的输入,然后存储在变量里。
Suppose instead, I want a machine that can take a recipe, the description of a sequence of steps, take that as its input, and then that machine will now act like what is described in that recipe.
假设换成这个,我想要一台可以安装描述,一系列步骤的结果的方法的机器,把那个当做输入设备,然后那台机器可以像方法中,描述的那样运行了。
And it still took it. And printed it up.
程序接受了输入,然后显示了这个字符串。
The format is the same. I'm going to ask for some input, and then I am going to use that procedure to check, is this the right type of value. And I'm trying to use that to do the coercion if you like. Same thing if it works, I'm going to skip that, if it not, it's going to throw the exception.
格式是一样的,我需要一些输入,然后我要用一个过程来检查,是否是正确的值,然后你就可以做强制转换了,如果能运行,那是一样的,我打算跳过这段,如果不正确,那就会抛出一个异常。
应用推荐