How would I get the user to input a fraction like 1/2, and have the program distinguish the numerator from the denominator?
How would I get the user to input a fraction like 1/2, and have the program distinguish the numerator from the denominator?
I am against the teaching of evolution in schools. I am also against widespread
literacy and the refrigeration of food.
Get input as a string, transform the digits before the / into one number, and the ones after the / into another.
Or let the user input two numbers instead of one.
MagosX.com
Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime.
That's what I want to know how to do! I heard about a function that makes the possible....but I forgot what it was.Originally posted by Magos
transform the digits before the / into one number, and the ones after the / into another.
I am against the teaching of evolution in schools. I am also against widespread
literacy and the refrigeration of food.
atoi (array to integer)
int atoi(const char*);
MagosX.com
Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime.
Thanks, thats what I was looking for!
I am against the teaching of evolution in schools. I am also against widespread
literacy and the refrigeration of food.