Let's say you have to go through three or four operations to get a final number, well, do it algebraically.
让我们说,你不得不通过3-4个操作,才能得到最终的数,好吧,用代数方法求解。
Just take a look: if this is 9, 5 divided by 9 is always going to be 0 point something, and if you thus have two integers and you're rounding down, which is what happens when you do integral math we're using this operator, I'm going to get zero times whatever.
稍微看一看:如果这是9,5除以9会得到,0点几,如果你用两个整型数,你舍去小数,这就是当你们,用整型数使用这个操作的所发生的事情,我将得到数值0乘以任何一个数字。
Count the number of primitive operations in each step.
数一数每一步中的基本操作,好的,如果我们看看这段代码。
But that little short hand there is doing exactly the same thing. It is adding that value into some digits and putting it back or signing it back into some digits. And I'll walk through that loop and when I'm done I can print out the total thing does. And if I do that, I get out what I would expect.
加上得到的这个数的,但是这个缩写声明其实是进行了同样的操作,它把我们得到的这个数加到一个数上面去,然后用和对这个数进行了重新赋值,在循环中会去遍历字符串,当完成循环后,程序会显示数字的总和,如果我运行,这个程序的话,我会得到我期待的结果。
应用推荐