pow function issues, need help.

I'm just beginning c++ and i need some help with this code. I'm trying to figure out why my command prompt gives my the answer 8 when i run and build this code. I thought the 'pow' function would take the 5 and raise it to the 8th power which would be 390,625.. so why is my code not working? thanks



#include <iostream>
#include <cmath>
using namespace std;


int main(){

double pow;

pow = (5.0, 8.0);

cout << pow << endl;

return 0;
}


check the following

http://www.cplusplus.com/reference/clibrary/cmath/pow/

I think pow will return a float
i tried this, it still got me the same answer so im still doing something completely wrong here

#include <iostream>
#include <cmath>
using namespace std;


int main(){

float pow;

pow = (5.0, 8.0);

cout << pow << endl;

return 0;
}
???? That's sooo NOT a function call. That's merely operator comma.

1
2
3
4
//First:  Don't use the function's name to declare a variable.  Don't use pow.
double powResult;  //Better.

powResult = pow(5.0, 8.0);
Thanks man, yeah im really new to this but that makes sense :)
Topic archived. No new replies allowed.