Problem2209--Stream operators overload

2209: Stream operators overload

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 319  Solved: 146
[Submit] [Status] [Web Board] [Creator:]

Description

Show how to overload the operators << and >> to create stream output for this class. Make these functions friends of the class Pair. The expected form of a pair is (2,3) for both input and output. To make this problem manageable, you should only provide to accept and discard the parentheses and comma, but you should not check that these particular characters were typed. Output should be the expected form. class IntPair { int first; int second; public: IntPair(int firstValue, int secondValue); int getFirst( ) const; int getSecond( ) const; };

Input

(a,b)

Output

(a,b)

Sample Input Copy

(2,3)

Sample Output Copy

(2,3)

Source/Category

30