I'm currently working with a group of my classmates on a recipe measurement converter, and I'm currently on the most difficult code of the three that is my part of the project. The code is basically for getting the amount from the user, a fraction. I have based my algorithm as reading the fraction as a string and converting it into an int. I haven't got a decent piece of code together yet, I'm still jotting out my algorithm and just keep getting turned around...please if someone can help with any ideas please do so I might can make a start at this!!! Thanks so much! Kat

I'm currently working with a group of my classmates on a recipe measurement converter, and I'm currently on the most difficult code of the three that is my part of the project. The code is basically for getting the amount from the user, a fraction. I have based my algorithm as reading the fraction as a string and converting it into an int. I haven't got a decent piece of code together yet, I'm still jotting out my algorithm and just keep getting turned around...please if someone can help with any ideas please do so I might can make a start at this!!! Thanks so much! Kat

without code its highly difficult to get the help here (- :)

You mean the input is something like this ?

<enter fraction > 123/452

And its read as a string.

If so then separate the string into 2 components the left side before the '/' character and the right side, after the '/' character. Then use the
atoifunction .

This article has been dead for over six months. Start a new discussion instead.