From 97a9865555617e965dfc16e35f3079f1520195fd Mon Sep 17 00:00:00 2001 From: Yang Yuhao <3160105521@zju.edu.cn> Date: Fri, 18 Oct 2024 09:05:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20cpp=5Ftricks=20=E4=B8=AD=E5=9C=B0?= =?UTF-8?q?=E6=9D=BF=E9=99=A4=E7=9A=84=E6=95=B0=E5=AD=97=E9=94=99=E8=AF=AF?= =?UTF-8?q?typo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/cpp_tricks.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/cpp_tricks.md b/docs/cpp_tricks.md index b5b5c20..18d64bd 100644 --- a/docs/cpp_tricks.md +++ b/docs/cpp_tricks.md @@ -88,13 +88,13 @@ std::wstring utf8_to_wstring(std::string const &s) { ```cpp int a = 14, b = 5; -int c = a / b; // c = 14 / 5 = 3 +int c = a / b; // c = 14 / 5 = 2 ``` 等价于 ```cpp -int c = floor((float)a / b); // c = floor(2.8) = 3 +int c = floor((float)a / b); // c = floor(2.8) = 2 ``` 如果 `a` 除以 `b` 除不尽,那么会找到比他大的第一个整数作为结果,这就是**地板除 (floor div)**。