M
MC felon
sorry for that!
anyway..
how do i make a function that takes 2 numbers as arguments (1 as the
number and the 2nd as
the exponent) and raises that number to the power (stored as exponent)
i worked this out.. though i could not get the logical statement inside
the for-loop right.
it's squaring itself for every one incrementation!
here's the listing:
double long pwr( double long num,int exp)
{
int y = 0;
for( y = 1;y <= exp; y++)
{
num = num*num;
}
return num;
}
anyway..
how do i make a function that takes 2 numbers as arguments (1 as the
number and the 2nd as
the exponent) and raises that number to the power (stored as exponent)
i worked this out.. though i could not get the logical statement inside
the for-loop right.
it's squaring itself for every one incrementation!
here's the listing:
double long pwr( double long num,int exp)
{
int y = 0;
for( y = 1;y <= exp; y++)
{
num = num*num;
}
return num;
}