round off function in vc.net
-
hello How to use round funcion in vc++.net ...?? I need to round off a float value, say 103.94568 to 103.95 Please help.... Salai
-
hello How to use round funcion in vc++.net ...?? I need to round off a float value, say 103.94568 to 103.95 Please help.... Salai
-
hello How to use round funcion in vc++.net ...?? I need to round off a float value, say 103.94568 to 103.95 Please help.... Salai
salaikumar wrote:
I need to round off a float value, say 103.94568 to 103.95
What is wrong with the old-fashioned way: adding .5 and casting to
int
(that is throwing the decimals away)? In your case you would additionally need to multiply by 100 before and divide by 100 afterwards to get the 2 decimal places.
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation." -- Caius Petronius, Roman Consul, 66 A.D.