Go Back   Forums > Community Chatterbox > Tech Corner > Programming
Memberlist Forum Rules Today's Posts
Search Forums:
Click here to use Advanced Search

Reply
 
Thread Tools Display Modes
Old 20-10-2005, 01:33 PM   #1
The Fifth Horseman
FUTURE SCIENCE BASTARD
 
The Fifth Horseman's Avatar


 
Join Date: Oct 2004
Location: Opole, Poland
Posts: 14,276
Default

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...
__________________

"God. Can't you people see I'm trying to commit a crime against science and nature here?"
-- Reed Richards
The Fifth Horseman is offline                         Send a private message to The Fifth Horseman
Reply With Quote
Old 20-10-2005, 03:02 PM   #2
Rinforzando
Forum hobbit

 
Join Date: Jun 2005
Location: Bicester, England
Posts: 45
Default

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
Rinforzando is offline                         Send a private message to Rinforzando
Reply With Quote
Old 20-10-2005, 04:37 PM   #3
Kon-Tiki
[BANNED]

 
Join Date: Sep 2004
Location: Dentergem, Belgium
Posts: 1,811
Default

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
Kon-Tiki is offline                         Send a private message to Kon-Tiki
Reply With Quote
Old 20-10-2005, 05:16 PM   #4
NrmMyth
Hero Gamer

 
Join Date: Jan 2005
Location: ,
Posts: 454
Default

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!
NrmMyth is offline                         Send a private message to NrmMyth
Reply With Quote
Old 21-10-2005, 07:16 AM   #5
Data
retired
 
Data's Avatar


 
Join Date: Jun 2004
Location: Jan Mayen, Svalbard and Jan Mayen
Posts: 2,167
Default

yeps
Code:
19/5 = 3
19%5 = 4
__________________
Flowing with the stream of life
Data is offline                         Send a private message to Data
Reply With Quote
Old 21-10-2005, 12:48 PM   #6
The Fifth Horseman
FUTURE SCIENCE BASTARD
 
The Fifth Horseman's Avatar


 
Join Date: Oct 2004
Location: Opole, Poland
Posts: 14,276
Default

Thanks people. You're real lifesavers...
__________________

"God. Can't you people see I'm trying to commit a crime against science and nature here?"
-- Reed Richards
The Fifth Horseman is offline                         Send a private message to The Fifth Horseman
Reply With Quote
Reply


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


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump
 


The current time is 02:56 AM (GMT)

 
Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.