So for an assignment in my CS2 class where I have to input a string of several fractions and the operation you want to perform (like: 3/4+12/18). I don't know how to take a string and divide it like that. I have the rest of the code in a two class structure where I can't do inheritance. Help please? This is what I have, but that's because I didn't know what to do
void fraction::setDenomNumer(string a)
{
int charOne, charTwo;
for(int i = 0;i < a.length()-1;)
{
if(isdigit(a[i])) // it is a number, so do some code
{
i++;
}
else // it is not a number, do something else
{
if(a[i] = '/')
{
charOne=a[i];
}
}
}
}