Mac-Windows Code Compatability

Hi guys,

I know this is a stupid question but I figured I might as well give it a shot...

I am taking a C++ course currently and my prof. uses a mac and I use windows. In doing some of the codes for the class I have found that I get different values from him and sometimes it doesn't make sense to me. Is there anything different about compiling in a different OS or different code writing software? For instance is there any difference in rounding at minute decimal places or anything else?

Please don't make fun of me
In terms of the actual code, as long as you stick with the standard headers:
<iostream>
<cstdio>
<cstdlib>
<cstring>
etc.

Then you shouldn't have any problems. Stay away from things like
<Windows.h>
<winsock2>
etc.

Also, stay away from system("pause") or anything system commands.

If you've done that then the program will be the same for Mac/PC. Now there is also the choice of compilers which will have some effects. I'm not sure about decimal rounding, but for things like srand() and rand() you will see differences. Depending on the prof's setup you may also get some things like int being 16 or 32 bits long, affecting which numbers can be stored. This is where the real difference comes in.
Topic archived. No new replies allowed.