Link to home
Start Free TrialLog in
Avatar of turbot_yu
turbot_yuFlag for Singapore

asked on

A simple IF expression

Hi,

I want to set a condition of
If temp_N mod 7 equals to 0 and (temp_N/7)>2,
I use the line below, but have error.
     if((MOD(temp_N, 7)==0)&int((temp_N/7)>1))

Any suggestion?

Regards,

Turbot
ASKER CERTIFIED SOLUTION
Avatar of SteveGTR
SteveGTR
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Though this should do what you want:

if ((temp_N % 7) == 0 && (temp_N / 7) > 1)
Avatar of turbot_yu

ASKER

Hi Steve,
When compile, still have error.
Does I need to add some .h file?

Thanks,

Turbot
Error code:

D:\backup\desktop\power grid\pqhub\DTP\code\socket class by its\corrected\Deliver for Tan\Aug of eventDTP\eventDTP.cpp(2055) : error C2065: 'MOD' : undeclared identifier
Error executing cl.exe.

eventDTP.obj - 1 error(s), 1 warning(s)
I don't know of a MOD function in the standard library. That's why I used the modulus operator (%).