Wait a minute... that answer I gave you overlooked a good standard library function... this is a perfect situation to use sscanf...
I am sure that by now you have been told that scanf is bad and you should avoid it. Well, it can be bad if it is not used well... but there is one thing it is very good for... masked input. It is good practice to first read input into a string then use sscanf to parse the string. Check this one out...
Code:
#include <cstdio>
#include <iostream>
using namespace std;
int main()
{
char buf[255];
int numer=0, denom=0;
cout << "Enter a fraction: ";
cin >> buf;
sscanf(buf, "%d/%d", &numer, &denom);
cout << "Numerator: " << numer << " Denominator: " << denom << endl;
return 0;
}