In Portland,Oregon, Jon Van Oast and Megan Kelley invited twelve friends to a Soup Swap.
VOA: special.2010.11.22
5 6 1 2 3 So it's 4, 5, 6 comma 1, 2, 3 that are passed into swap and that's why those same numbers end up in A and B. Yeah?
所以这里是,这就是为什么这些数字最终在a和b中,请说?
In the second case, I found in the next smallest element and moved here, taking what was there and moving it on, in this case I would swap the 4 and the 8, and in next case I wouldn't have to do anything.
在第二次遍历中,我找到了,第二小的元素,把它移到这里,把这里原来的元素移到哪里,在这一次遍历中,我会把8和4交换,然后一次遍历,不会做任何事情。
The two heads of states are also expected to discuss Egypt's efforts to mediate a prisoner swap between Israel and Hamas.
VOA: standard.2009.09.13
So, a couple of weeks ago we proposed to swap two integers, and we couldn't at the time.
那么,几周前,我们提出交换两个整数,然而在那时,我们办不到。
Mr.Netanyahu said he will fly on Tuesday to Egypt, which has been mediating between Israel and Hamas on the prisoner swap.
VOA: standard.2009.12.27
And I'm going to hook you up to my machines and swap your minds.
我准备把你们绑在机器上,交换意识。
In a statement to the media, he said Israel and Hamas are "not on the brink of a deal" and that he fears negotiations on a prisoner swap could take years.
VOA: standard.2009.10.03
You actually need to kind of do this and then you can swap these two numbers but it requires 50 percent more memory.
你实际上需要这样做,然后才能交换两个数字,但是它需要多50%的内存。
He said Ankara's decision to vote 'no' was also based,in part, on the timing of the announcement earlier Wednesday by the United States, France and Russia rejecting the fuel swap deal negotiated by Turkey and Brazil.
VOA: standard.2010.06.09
I then insist, okay, swap, and then I print out their values again.
我再强调,好的,交换好了,然后我再打印出,它们的值。
swap I'm going to keep track of a little variable called swap, it's initially true, and as long as it's true, I'm going to keep going, but inside of the loop I'm going to set it to false, and only if I do a swap will I set it to true.
我打算跟踪一个小的变量称为,初始值为真,只要它是真的,算法就会继续,但是在循环里,我打算把他设为假,除非交换发生,就把它设为真。
Just swap these two values for me and let me move on is the reasoning.
只要帮我把这两个值交换,让我继续往下执行。
So, in this program when we call this version of swap 1 and 2 do not end up here, right?
所以,在这个程序中,当我们调用这个swap版本1,和版本2,不是在这里结束,对不?
I'm simply saying swap X with Y, but this 2 won't work, because where are X and Y defined?
我只简单地说交换X和Y,但是这两行不起作用,因为X和Y是在哪里定义的呢?
And what happens the moment I call swap, as I said earlier, you get a copy of the inputs.
当我调用swap时会发生什么,之前说过的,你得到一个输入。
It's in a file called swap.C. Everything should be alphabetical so it should be toward the end of this week's packet and notice that it's almost identical except for a couple of syntax changes.
在一个叫做swap。c的文件中,对于这周末的数据包来说,所有的东西都是字母,请注意,除了几个语法改变,它几乎是一样的。
int A Well, one, function has called swap, takes one int called A, printf followed by another int called B, and as we've seen with print F, if you have multiple arguments, you separate them by commas.
好的,函数叫做swap,一个参数是,另一个参数是int,B,我们看到的,如果你有好几个参数,把它们用逗号分开。
swap If main wants to give access to swap to x and Y, it just has to tell swap where x and y are.
如果main函数想要对x和y使用,只要告诉swap,x和y在哪里。
This code does swap the two values, A and B. However, when I run this program, something happens.
这个代码没有交换那两个值,A和B,但是,当我运行这个程序时,有些事情发生了。
X So here I'm declaring another variable called X, and this is totally legitimate because I already know that if I'm implementing a function like swap or increment, I can absolutely take input.
这里我声明另一个变量,这个完全是合法的因为我已经知道,如果我执行一个像swap,或,increment的函数,我完全可以携带输入。
Well, simply with the * notation at least on the way in when you declare the function called swap, you simply say this is not going to take an int and another int because that's useless.
好的,简单说,当你声明一个函数调用swap函数时,使用*符号,你可以简单说,这不能使用一个int数和另外一个int数,因为那是无效的。
int Y Well, I said int X and int Y; so that gave me one square here called X, one square here ; or wherever, called Y, done, one was put in here; two was put in here, and then I called this function swap.
好的,我声明了int,X,和;,然后我这里有个正方形叫做X,一个正方形,叫做Y,完成,1放在这里;,2放在这里,然后我调用这个swap函数。
I get to the end of the loop, and I actually do a little bit of wasted motion there. And the little bit of wasted motion is, I take the value at i, store it away temporarily, take the value where min index is pointing to, put it back in there, and then swap it around.
我走到了循环的末尾,事实上我做了多余的动作了,有点多余的是我把i的值,临时保存起来了,看看MinIndex指向的值,放回到哪里,然后再交换。
X That's just the special symbol in C that says don't pass X, that is don't pass a copy of X. Rather figure out where x is in memory, where he is in that frame and provide swap the numeric address in RAM of that value so that swap can go do anything it wants at that address.
这在C中是一个特殊的符号,指明不传送,也不是传递X的拷贝,而是指出x在内存中哪个地方,它在那个框架中的哪个地方,提供给swap它的地址值,这样swap就可以使用那个地址中的数据。
So this is version two of the swap function and, in fact, it is almost identical, this is before, this is after, before, after and it looks like the solution to this problem that we've been revisiting a couple of times now is just to do what?
这个swap函数的第二个版本,实际上,这几乎是一样的,这是之前的,这个之后的,之前的,之后的,这看起来像是这个问题的解决方案,我们一直多次访问它,目的是什么呢?
And now the point just to tease apart, I can't erase that, let's fix, so now the one detail that's worth pointing out is * that this here the * in swap's prototype and the * here in swap's prototype do not mean go there.
现在我们要梳理一下,我不能清除那个,让我们修正一些,需要指出的一个细节是,在swap原型中的,意思不是定位到那个地方。
Indeed, swap in your printout there is just defined as now taking *a and *b and then it also uses the * later, but we'll come back to what the different uses of the * means, but for now I claim conceptually it just means swap has access to the locations of its parameters.
的确,在打印资料中的swap被定义为,携带*a和*b,之后它也是带*号的,但是我们将说明*的不同用法,现在,我断言swap可以,使用参数的地址。
I'm reminded of the confirmation screen here and that's not too bad, then we put in the card and we click confirm and then finally we see the swap Then finally literally nine steps later the ticket comes out of the machine and then, frankly, had to go through the process of where to put the ticket in the machines.
这里出现了确认画面,那还不是太坏,然后我们把卡插进去,点击确认,然后我们看到了那个,函数。,swap,function。,【笑声】然后最终经过9个步骤,票从机器中出来了,然后,需要找出从哪里,把票放到机器中去。
应用推荐