We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0dd85de commit 97a9865Copy full SHA for 97a9865
docs/cpp_tricks.md
@@ -88,13 +88,13 @@ std::wstring utf8_to_wstring(std::string const &s) {
88
89
```cpp
90
int a = 14, b = 5;
91
-int c = a / b; // c = 14 / 5 = 3
+int c = a / b; // c = 14 / 5 = 2
92
```
93
94
等价于
95
96
97
-int c = floor((float)a / b); // c = floor(2.8) = 3
+int c = floor((float)a / b); // c = floor(2.8) = 2
98
99
100
如果 `a` 除以 `b` 除不尽,那么会找到比他大的第一个整数作为结果,这就是**地板除 (floor div)**。
0 commit comments