Custom I/O Operators

  • Ray Lischner


Wouldn’t it be nice to be able to read and write rational numbers directly, for example, std::cout << rational{355, 113}? In fact, C++ has everything you need, although the job is a little trickier than perhaps it should be. This Exploration introduces some of the pieces you need to accomplish this.


Test Program Output Operator Input Stream White Space Output Stream 

Copyright information

© Ray Lischner 2013

Authors and Affiliations

  • Ray Lischner
    • 1
  1. 1.MDUS

Personalised recommendations