Author |
Message |
AsianSensation
|
Posted: Wed Sep 10, 2003 7:20 pm Post subject: syntax for math operations? |
|
|
how do you use mod and exponents in c++?
*mod as in modular math. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Catalyst
|
Posted: Wed Sep 10, 2003 7:29 pm Post subject: (No subject) |
|
|
mod is %
and exponent is the function float pow(float num,float exp) in <math>
avoid pow whenever necessary it can be very very slow (i.e use x*x*x over pow(x,3)) |
|
|
|
|
|
AsianSensation
|
Posted: Wed Sep 10, 2003 7:33 pm Post subject: (No subject) |
|
|
so if I want to check if a number is a divisor of another, I do this?
code: |
if (num % 5 == 0)
blah blah blah
|
|
|
|
|
|
|
Catalyst
|
Posted: Wed Sep 10, 2003 7:37 pm Post subject: (No subject) |
|
|
yup just like that |
|
|
|
|
|
AsianSensation
|
Posted: Wed Sep 10, 2003 7:48 pm Post subject: (No subject) |
|
|
cool, thanks Catalyst.
I have another question, how about the square root syntax, and does anyone know a site where I can get a list of the syntax and their uses? |
|
|
|
|
|
Mazer
|
|
|
|
|
Catalyst
|
Posted: Wed Sep 10, 2003 8:09 pm Post subject: (No subject) |
|
|
Square Root is just float sqrt(float n)
heres another good site:
www.cplusplus.com |
|
|
|
|
|
AsianSensation
|
Posted: Wed Sep 10, 2003 8:34 pm Post subject: (No subject) |
|
|
cool, thanks guys. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
naoki
|
Posted: Sat Sep 20, 2003 2:23 pm Post subject: (No subject) |
|
|
indeed those sites will help negate the AWESOME UNQUESTIONABLE GREATNESS of my comp sci teacher |
|
|
|
|
|
Andy
|
Posted: Sat Sep 20, 2003 10:21 pm Post subject: (No subject) |
|
|
cppreference.com sux, it dont give u much info on the functions... |
|
|
|
|
|
naoki
|
Posted: Sun Sep 21, 2003 12:02 pm Post subject: (No subject) |
|
|
considering the purpose of the site and the lack of any advertisement or help to fund the site, i think cppreference is pretty damned nice to pay for its domain for the content it gives.
also try cprogramming.com and codenewbie.com |
|
|
|
|
|
bugzpodder
|
Posted: Sun Sep 21, 2003 12:28 pm Post subject: (No subject) |
|
|
dodge_tomahawk wrote: cppreference.com sux, it dont give u much info on the functions...
i like cppreference, in fact i have printed out the whole website so i could use it in CCC - stupid school doesnt even have MSDN |
|
|
|
|
|
|