Those values are "double" type. So the compiler won't know what function to use - it can convert double to float or int, but it there's no function that takes double as such - so it doesn't know which of the two present versions to use. If you add an "f" to the end of the number, it will be a float instead, which will allow your compiler to choose the float function. E.g. 11.12f.

As Salem says, 11.12f is a float value, 11.12 is a double. It would have been possible for the compiler designers to make it the other way around - then you would have asked why it doesn't work when you defined a function like double max(double a, double b); passed the undecorated arguments 11.12, 8.6 - because you didn't have 11.12d, 8.6d or whatever the syntax would be.

There is no way for the compiler to tell the difference between 11.12 as a double or as a float - so you have to define that it is one or the other - the choice was to make the slightly more common double the default. Go beat up some old programmer who came up with the idea if you like, but aside from the potential satisfaction it may give you and the risk of a prison sentence, I don't think it will change anything.

345 is by default int and not a long data type... For 11.12 the float is the closest match as compared to double So I am confused

Fine - you just have to accept that float needs a postfix to say that it's float, and integers don't need to be said that they are "normal" integers, but an L if you want to make it long. It's just one example of all the inconsistencies in programming languages - it's been that way for many years, and it will probably continue for many years to come.

Yes, but 345L is a long int literal. According to the C++ Standard:
"The type of an integer literal depends on its form, value, and suffix. If it is decimal and has no suffix, it has the first of these types in which its value can be represented: int, long int; if the value cannot be represented as a long int, the behavior is undefined. If it is octal or hexadecimal and has no suffix, it has the first of these types in which its value can be represented: int, unsigned int, long int, unsigned long int. If it is suffixed by u or U, its type is the first of these types in which its value can be represented: unsigned int, unsigned long int. If it is suffixed by l or L, its type is the first of these types in which its value can be represented: long int, unsigned long int. If it is suffixed by ul, lu, uL, Lu, Ul, lU, UL, or LU, its type is unsigned long int."

For 11.12 the float is the closest match as compared to double So I am confused

According to the C++ Standard:
"The type of a floating literal is double unless explicitly specified by a suffix. The suffixes f and F specify float, the suffixes l and L specify long double. If the scaled value is not in the range of representable values for its type, the program is ill-formed."

That is perfectly valid - what you call your parameters in the prototype and what you call them in the function definition (implementation) is completely separate names - in fact, you can - should you wish, not give them any name at all

Code:

float max(float,float);

is fine.

It's also fine to completely change the names when you declare the prototype and when you define the function: