![]() |
| ||
| windows and linux Hi all! I'm working in a project in visual c++ 6.0 with the console application and I want to ask you how to create a program that has portability to work in both platforms, windows and linux. Another thing, which function we use to round a double to the nearest int number? Thanks, |
| ||
| Re: windows and linux >how to create a program that has portability to work in both platforms, windows and linux. Write 100% standard C++, or conditionally compile two different programs customized for the two operating systems. >which function we use to round a double to the nearest int number? You'll need to write it yourself, or use a clever workaround. Alternatively, if all you need is to print the rounded double, any formatted output option will do it for you (which opens up ideas for those clever workarounds I was talking about). |
| ||
| Re: windows and linux Quote:
|
| ||
| Re: windows and linux Quote:
Quote:
no? |
| ||
| Re: windows and linux Not bad, but where you say (floor(dAUX) - dAUX) < (ceil(dAUX) - dAUX), I think you mean (dAUX - floor(dAUX)) < (ceil(dAUX) - dAUX).Personally, I prefer floor(dAUX + 0.5), if I want to always round .5s in the positive direction. |
| ||
| Re: windows and linux Quote:
fabs(floor(dAUX) - dAUX)) < fabs(ceil(dAUX) - dAUX)Quote:
|
| All times are GMT -4. The time now is 11:26 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC