You can’t. You would need to write a class dedicated to holding rational numbers (i.e. fractions). Or maybe just use the Boost Rational Number library.
More Related Contents:
- How to shift characters to ASCII values in a file based on user input c++ [closed]
- What is wrong using c++ copy function?
- C ++ Homework giving me problems
- What’s the difference between “STL” and “C++ Standard Library”?
- How can I convert a std::string to int?
- Using std Namespace
- How to convert wstring into string?
- Why is transposing a matrix of 512×512 much slower than transposing a matrix of 513×513?
- Is there any overhead to declaring a variable within a loop? (C++)
- The written versions of the logical operators
- VSCode c++ task.json include path and libraries
- templates: parent class member variables not visible in inherited class
- Does “const” just mean read-only or something more?
- StdAfx + Header file – Order of inclusion in MFC application
- Loop unrolling to achieve maximum throughput with Ivy Bridge and Haswell
- Compilation error: “stddef.h: No such file or directory”
- Near and Far pointers
- Understanding double dispatch C++
- C++ Windows – How to get process path from its PID
- C++ int with preceding 0 changes entire value
- How do you throttle the bandwidth of a socket connection in C?
- Special characters in Visual Studio 2019 C++ project AND executing CMD commands with them
- How can I resize a 2D vector of objects given the width and height?
- Is stl vector concurrent read thread-safe?
- Do pthread mutexes work across threads if in shared memory?
- Why is there no std::protect?
- “please check gdb is codesigned – see taskgated(8)” – How to get gdb installed with homebrew code signed?
- getchar_unlocked( ) VS scanf() VS cin
- DoEvents equivalent for C++?
- get part of std::tuple