I have the following assignment due:
Design a class -say, fraction - that performs the arithmetic and relational operations on fractions. Overload the arithmetic and relational operators so that the appropriate symbols can be used to perform the operation. Also, overload the stream insertion and stream extraction operators for easy input and output.
Write a C++ program that, using the class fraction, performs operations on fractions.
Among other things, test the following:
Suppose x, y, and z are object of the type fraction. If the input is 2 / 3, the statement:
cin >> x; should store 2 / 3 in x. The statement:
cout << x + y << endl; should output the value of x + y in fraction form. The Statement:
z = x + y; should store the sum of x and y in z in fraction form. Your answer need not be in the lowest terms.
my question is how do you store a fraction such as 2/3 into cin>> ?