How to divide 2 int values in MS C++?
Posted on 2011-09-22
Regardless I’m professional programmer with good experienceI’m like baby on MS C++ 2008. Could you please help me with this simple question (but may be not so easy in C, xexe )?
I should divide 2 Integer values and to get back to integer. The precision is not very necessary, if result is for example 2.7 will be nice to get it as 3, but if I get it like 2 will be acceptable. I do not want to include any additional libraries for a divide, my project is 99 % ready.
My experience with Vb6 and C# tell me to try like this, with attempt to make round
Int InterruptAtMS = 10630; double mFramePerMsSeconds=40;
int nFrame= (int)((double)InterruptAtMS / mFramePerMsSeconds);
but it doesn’t work. Suggestion?