|
20-10-2005, 01:33 PM | #1 | ||
Join Date: Oct 2004
Location: Opole, Poland
Posts: 14,276
|
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...
|
||
|
|
20-10-2005, 03:02 PM | #2 | ||
Join Date: Jun 2005
Location: Bicester, England
Posts: 45
|
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.
__________________
Let teh phantasy rule your mind |
||
|
|
20-10-2005, 04:37 PM | #3 | ||
Join Date: Sep 2004
Location: Dentergem, Belgium
Posts: 1,811
|
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 |
||
|
|
20-10-2005, 05:16 PM | #4 | ||
Join Date: Jan 2005
Location: ,
Posts: 454
|
Operator / concerning two integers returns an integer.
Expresions: 19/5=3; 19/(5.0)= 3.8;
__________________
Never mess with me when I have a cougar, Never! |
||
|
|
21-10-2005, 07:16 AM | #5 | ||
Join Date: Jun 2004
Location: Jan Mayen, Svalbard and Jan Mayen
Posts: 2,167
|
yeps
Code:
19/5 = 3 19%5 = 4
__________________
Flowing with the stream of life |
||
|
|
21-10-2005, 12:48 PM | #6 | ||
Join Date: Oct 2004
Location: Opole, Poland
Posts: 14,276
|
Thanks people. You're real lifesavers...
|
||
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Free Virtual Pc Equivalents? | The Fifth Horseman | Tech Corner | 14 | 18-05-2005 09:40 AM |
|
|
||
  |