Frunction

how can I do this in C++
I know how can I make functions , classes and object of class , but I can not make the operation
the operation is :

1- function that will return true if the fraction value is greater than one (for example: 7/5 is greater than one).

2- subtract one from the fraction (for example: 7/5 will become 2/5).

3- return the decimal equivalent of the fraction (for example: the decimal equivalent of 1/2 is 0.5).

all of these options in more than one function.
What have you written so far? All three of those things are easy to do if you took any math class in high school.
Ok, can you help me please?
how can I do this in C++
I know how can I make functions , classes and object of class , but I can not make the operation
the operation is :

1- function that will return true if the fraction value is greater than one (for example: 7/5 is greater than one).

2- subtract one from the fraction (for example: 7/5 will become 2/5).

3- return the decimal equivalent of the fraction (for example: the decimal equivalent of 1/2 is 0.5).

all of these options in more than one function.

What have you written so far?
I think you're confused because the function appears to be returning two different things. You can do this in C++ by returning one thing in the return value and another thing in a reference parameter:
1
2
3
// Given the numerator and denominator of a fraction, return true if the fraction
// is greater than 1. Otherwise subtract one and return the value in "res"
bool func(unsigned numerator, unsigned denominator, double &res)
@dhayden: I think the list items are each separate functions.
@dhayden: thank you to help me.
Topic archived. No new replies allowed.