istream & operator >> (istream & in, rational & r) { // read a rational number from an input streamint t, b;// read the topin >> t;// if there is a slash, read the next numberchar c;in >> c;if (c == '/') in >> b; // read bottom partelse { in.putback(c); b = 1;}// do the assignmentrational newValue(t, b);r = newValue;// return the streamreturn in;
istream & operator >> (istream & in, rational & r) { // read a rational number from an input streamint t, b;// read the topin >> t;// if there is a slash, read the next numberchar c;in >> c;if (c == '/') in >> b; // read bottom partelse { in.putback(c); b = 1;}// do the assignmentrational newValue(t, b);r = newValue;// return the streamreturn in;