|
-
February 10th, 2003, 11:34 AM
#1
Hi
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 ?
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;
}
Thanks in advance
Regards,
[Yves: try to find a better title for your post than 'Hi' ]
Last edited by Yves M; February 10th, 2003 at 12:11 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|