aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2024-07-26 02:13:23 +0100
committerAryadev Chavali <aryadev@aryadevchavali.com>2024-07-26 02:54:02 +0100
commit5cbdf7a045c18877b8ae83a7f105e1cf32866a79 (patch)
tree74a8abb80f82893c105fcbb7a03d640411946ab0 /src/main.cpp
parentaad22a1b203c2e8dcdc564da9e94f7b7796d0221 (diff)
downloadcw_tree-5cbdf7a045c18877b8ae83a7f105e1cf32866a79.tar.gz
cw_tree-5cbdf7a045c18877b8ae83a7f105e1cf32866a79.tar.bz2
cw_tree-5cbdf7a045c18877b8ae83a7f105e1cf32866a79.zip
Added to_string for fractions
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
index d355694..91accad 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -75,6 +75,13 @@ struct Fraction
}
};
+std::string to_string(const Fraction &f)
+{
+ std::stringstream ss;
+ ss << f.numerator << "/" << f.denominator;
+ return ss.str();
+}
+
struct Node
{
Fraction value;