I wrote a function like this to get the largest value among the threes, but the returned value when 'cout'ed in the main function is the same-->12.4242. Could anyone here tell me why ?
Thanks in advanceQuote:
template <typename T>
T max(T x,T y,T z){
T holdmax=x;
if(y>=holdmax)
holdmax=y;
if(z>=holdmax)
holdmax=z;
return holdmax;
}
int main(){
cout<<max(12.42422,12.42421,12.42420)<<endl;
return 0;
}
Regards,
[Yves: try to find a better title for your post than 'Hi' ;)]
