I don't know why this isn't working. fact is a factorial function which I have tested and it works fine.
but when I input, for example
int main()
{
cout<<expression(1,3)<<endl;
getch();
return 0;
}
it comes up with an error.
can anyone see what i am doing wrong?
That's the thing I don't know. It just says build unsuccessful. Normally if something is wrong there is a red line under what is wrong or it says something useful in the build bit at the bottom. But it just says "build unsuccessful"
:/
Assuming you're including all the necessary headers, these are the compile errors I got with your code in ideone.com.
prog.cpp: In function ‘double expression(int, double)’:
prog.cpp:7:24: error: ‘a’ was not declared in this scope
double num=(pow((x),2*a));
^
prog.cpp:8:21: error: ‘fact’ was not declared in this scope
double den=fact(n,a);
^