• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

Math symbol help in C++

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

XWRed1

Senior Member
Joined
Oct 31, 2001
#include <math.h>

Then use the pow() function:
SYNOPSIS
#include <math.h>
double pow(double X, double Y);
float pow(float X, float Y);

DESCRIPTION
`pow' and `powf' calculate X raised to the exp1.0nt Y.
 
OP
o0OBruceLeeO0o

o0OBruceLeeO0o

Member
Joined
Aug 18, 2002
Location
Charlotte, NC
Im getting errors with it so Im gonna make sure im using it right :)... If x = 10 and y = 5 then pow would = 100000 right? Can I use pow as a normal variable? Or am I right in thinking its one of those special words that you cant use because its taken by a header or something (ie math.h) . Sorry I am new :)
 

Thelemac

Administratively Deficient
Joined
Mar 15, 2001
It's a function...so it you would use it like so:

float x;
float y;
float z;

z=pow(x,y); // z = x^y

:)
 
OP
o0OBruceLeeO0o

o0OBruceLeeO0o

Member
Joined
Aug 18, 2002
Location
Charlotte, NC
ok thats what Im doing but its not giving me the right output! Guess i have an error elseware :). Thanks for replies


edit: I had a + where I needed a * :eek: . Works great now :)
 
Last edited: