04-24-2011, 06:17 PM
when we write a function to calcute the power of some number, will we only save it or we will cobpile
and run it?plz clearify it,im so much cnfused.when we write d program to call the function, what will we do? whether we compile it or not?plz help me.i write the function as below.is it correct?what wil i do with dis?
will i cmpile it? plz guide me
//function to calculate the power of some number
double raiseToPow(double x,int power)
{
double result;
int i;
result=1.0;
for(i=1;i<=power;i++)
{
result *= x; //same as result = result * x
}
return(result);
}
and run it?plz clearify it,im so much cnfused.when we write d program to call the function, what will we do? whether we compile it or not?plz help me.i write the function as below.is it correct?what wil i do with dis?
will i cmpile it? plz guide me
//function to calculate the power of some number
double raiseToPow(double x,int power)
{
double result;
int i;
result=1.0;
for(i=1;i<=power;i++)
{
result *= x; //same as result = result * x
}
return(result);
}