From b25b314d2a6f3928e71f4170710117a6ad0dd632 Mon Sep 17 00:00:00 2001 From: Jie Date: Tue, 7 Jan 2025 15:05:57 +0800 Subject: [PATCH] add function round --- include/toolkit.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/toolkit.h b/include/toolkit.h index 8cb8c1f..04413ce 100644 --- a/include/toolkit.h +++ b/include/toolkit.h @@ -10,6 +10,7 @@ #include #include #include +#include namespace ranges = std::ranges; namespace views = std::ranges::views; @@ -97,6 +98,14 @@ namespace toolkit { return T(word.begin(), word.end()); }); return std::vector(v.begin(), v.end()); } + + double round(double value, int c){ + auto temp = 1; + for(int i=0;i