+ 1
A challenge: Make a function that can take a double and an int as its arguments,and returns the biggest number.
(returns an int if the int is the biggest number,else returns the double),also don't include any file or create the main function.(a 2 lines code).
4 Antworten
+ 2
double max(double d, int i) {
return (d > i ? d : i);
}
+ 2
AFAIK, that's not possible in c++, or any language with strong typing.
0
Your function returns always double.It should have possibility to return an int or double.
0
use tuple