Here is my code
[code]
#include
#include
using namespace std;
double factorial(double n)
{
factorial=n;
while (n>1)
{
factorial=(factorial*(n-1));
n--;
}
return factorial;
}
int main()
{
double n;
double factorial;
cout<<"Enter the value for which you want its factorial: \n";
cin>>n;
cout<<"The factorial is "<
return 0;
}
[/code]
I know the factorial function is right because when I include it in main() it works on its own, but referencing it as a function is causing some error problems:
error C2659: '=' : function as left operand
error C2296: '*' : illegal, left operand has type 'double (__cdecl *)(double)'
error C2440: 'return' : cannot convert from 'double (__cdecl *)(double)' to 'double'. There is no context in which this conversion is possible
error C2064: term does not evaluate to a function taking 1 arguments.
Any ideas as to what I did wrong?
2007-02-26
06:46:00
·
4 answers
·
asked by
?
2
in
Computers & Internet
➔ Programming & Design