0

what is wrong with this code?

int myFunction(int b)
{
int c;
double z = b;
double d;
int y=0;
while (d<0)
{
d= (z/pow(10,y));
c = (int)d;
c = c%10;
if (!(c=1))
++y;
else
b=0;
}
return b;
}

The compiler gets 3 erros of the pow():

- math.h(575): could be 'long double pow(long double,int)'
- math.h(527): or 'float pow(float,int)'
- math.h(489): or 'double pow(double,int)'

thx
Mandana

3
Contributors
2
Replies
3
Views
10 Years
Discussion Span
Last Post by Nick Evan
0

And now to solve your problem:

Pow() wants 2 doubles as parameters, but y is declared as an int.
So change int y to double y and you're on the roll!

int myFunction(int b)

You might want to change this in double myFunction(double b) because you assign the value of b to a double (z) in your code : double z = b

Edited by Nick Evan: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.