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

Recommended Answers

All 2 Replies

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 .

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.