1) Please use codetags when posting code to the forum.
2) You are missing a semicolon after your function prototype
double power(double x,int y)
which by the way you don't need since your power() function is defined before int main(). You would only need a prototype if it was defined AFTER main().
3) You have 2 int main() delete the one right after your prototype for power(). I believe you meant this to be a prototype also but int main() doesn't need a prototype and can only be declared ONCE.
4)
1 2
|
cout << "enter value a = " << a <<endl;
cout << "enter value b = " << b <<endl;
|
You are asking them to enter a value but never give them the chance to enter it. You just print the value in a and b (Which is undefined behavior since you have not yet defined what value is in either of them).
Do something like this
1 2
|
cout << "Enter value a = ";
cin >> a;
|
That is how you ask the user for input and store it in the variable a.
5) The biggest one of all you don't even write a function to calculate the power! You are just using the pow() function and returning the result. Make sure you make your own function for power or you will fail on the grading.
Also your function definition is wrong. A definition for a function should look like this.
1 2 3 4
|
double power(double x, double y)
{
// Your code goes here
}
|
6) You created your power() function (Which does nothing really) but you don't even use it. You instead use the pow() function.
7) Watch how you format your code. Be consistent.