Okay... I could help a bit. I will try to write as little code as possible. I will also explain how to do this using the C set of functions for reading and writing.
I'm assuming your operators are correct, that a class containing 3/2 and a class containing 2/3 when multiplied using the operator will set the first class to 6/6.
Get an extra rationalNumbers class in main(), called test2 (example). Then, you will need
deque<int> data;
(not vector). Also, you will need a string called input. Store the output from your cin in this.
---------------
You will be storing your data in this deque. Make a function that uses a while loop, named
int read(deque<int> &inp)
. Inside, you will need a boolean value set to zero. You will also need three integers, and two strings. From there, initialize the second string to anything, so long as it's not a newline.
while (string2 != "\n")
Now, inside, you will check your string character by character. For this, you will need four strings and four integers.
Read each character until you get something that isn't an integer and isn't a whitespace, then copy everything up to that point into your first string, convert it to and integer, and store it in your first integer. Continue reading until you find something that is an integer, then copy what you read into the second string, convert it to your integral representation of your operator, store it in the second integer. Repeat, except using the third and fourth strings and ints.
Then, use push_back() for your deque to insert your integers into your deque. Repeat this and the above paragraph until you reach the end of the string you're reading from.
---------------
From there, in main(), read the first block and the third block, and set the numerator and denominator (in your first class) to those, respectively. Then, read the fifth block and seventh block, and store that in the second class's numerator and denominator. Then, perform the computation between them according to what is stored in the fourth block (I recommend using a chain if if-else statements).
Delete the first seven blocks of the deque using pop_front(), and then use push_front() to write (in this order) the denominator of the result of your computation, a division integer, and the numerator of the result of your computation.
http://cplusplus.com/reference/stl/deque/
Keep going until your deque has exactly three elements.
-Albatross