Hi,

I wonder if you ever tried the following instruction:

Number = (int) (x+0.5);

 

Moshe

 

 

  _____  

From: Tamas Marki [mailto:[email protected]] 
Sent: Wednesday, March 17, 2010 8:55 PM
To: [email protected]
Subject: Re: [c-prog] rounding in C++

 

  

On Wed, Mar 17, 2010 at 6:12 PM, Jos Timanta Tarigan <
jos_t_tarigan@ <mailto:jos_t_tarigan%40yahoo.com> yahoo.com> wrote:

>
>
> hi,
>
> does C++ has other rounding except floor and ceil ie. decimal more than
0.5
> ceil, floor otherwise?
>

If you have a C99 conforming compiler then you can #include <math.h> and use
round () from there.

-- 
Tamas Marki

[Non-text portions of this message have been removed]





[Non-text portions of this message have been removed]

Reply via email to