Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » General Discussions » General Discussion » OT: C++ Recursion
Re: OT: C++ Recursion [message #192156 is a reply to message #192146] Tue, 07 March 2006 21:56 Go to previous messageGo to previous message
Ryan3k is currently offline  Ryan3k
Messages: 363
Registered: September 2004
Location: USA
Karma:
Commander
CPUKiller has pretty much got it, I don't know C++ myself, but I know Java, and all you need to know is that the '%' operator is for modular division, and it gives you the remainder of a/b.

For example,
10 % 3 = 1
10 % 10 = 0
12 % 5 = 2

Another important note is that because it is an int, it will truncate decimals. In the first runthrough of ValueOf, when you divide 11 by 2, you get 5.5, right? Well, it won't round it up to 6. It truncates the decimal, and you end up with 5.

5 becomes the new 'N', passed as parameter to ValueOf... etc. etc.


 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: RA2 Mission
Next Topic: Renegade Website
Goto Forum:
  


Current Time: Tue Jul 22 14:32:38 MST 2025

Total time taken to generate the page: 0.01007 seconds