From 5cbdf7a045c18877b8ae83a7f105e1cf32866a79 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Fri, 26 Jul 2024 02:13:23 +0100 Subject: Added to_string for fractions --- src/main.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') 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; -- cgit v1.2.3-13-gbd6f