View Full Version : C++ Mod And Div Equivalents?
The Fifth Horseman
20-10-2005, 01:33 PM
Simple. What are the commands in C++ equivalent in function to Pascal MOD and DIV commands? I need this little detail for a program of mine...
Rinforzando
20-10-2005, 03:02 PM
Mod is the percentage sign - %
I don't know if there is one for div, but you can just use the / operator, then disregard the fractional part.
Kon-Tiki
20-10-2005, 04:37 PM
If DIV is division (I don't know Pascal, so I'm just going on the shape of the word), you just use / for divisions.
E.G.
x = 10;
x = x/5;
print x;
OUTPUT: 2
NrmMyth
20-10-2005, 05:16 PM
Operator / concerning two integers returns an integer.
Expresions:
19/5=3;
19/(5.0)= 3.8;
The Fifth Horseman
21-10-2005, 12:48 PM
Thanks people. You're real lifesavers...
vBulletin® v3.7.1, Copyright ©2000-2025, Jelsoft Enterprises Ltd.