istream & operator >> (istream & in, rational & r) { // read a rational number from an input stream int t, b; // read the top in >> t; // if there is a slash, read the next number char c; in >> c; if (c == '/') in >> b; // read bottom part else { in.putback(c); b = 1; } // do the assignment rational newValue(t, b); r = newValue; // return the stream return in;

Previous slide Back to first slide View graphic version