| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
how to convert decimal numbers to nearest interger in C++.thanks.
waiting 4 reply. -brix |
|
#2
|
|||
|
|||
|
You can use the std lib functions round and trunc. Trunc will just remove the decimal part. Round will return the closest integer (rounding up for 0.5 or above and down otherwise).
Hope this helps, -KM- |
![]() |
| Viewing: Dev Articles Community Forums > Programming > C/C++ Help > c++(how to convert decimal numbers to nearest integer |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|