0

I am writing a program that calculates factorials. I have everything fixed except I can't seem to get case ('Y'), case ('y'), in the switch to start the program over. If you have another number you'd like to calculate then you say y and it starts the program back over again. Any hints? I get an error C2440: 'return' : cannot convert from 'int (__cdecl *)(void)' to 'int'

Thanks. Here is my program so face:

```
#include <iostream>
using namespace std;
int factorial(int n)
{
int res = 1,i;
for (i=1;i<=n;i++)
{
res *= i;
}
return res;
}
int dfact(int n)
{
int i;double res=1.0;
for(i=n;i>=1;i-=2)
{
res *=i;
}
return res;
}
int main( )
{
int n;
cout << "Enter the number=";
cin >> n;
cout << n << "! = " <<factorial(n) << endl; //factorial output
cout << n << "!! = " <<dfact(n) << endl; //double factorial output
int num;
cout << "Whould you like to enter a new number? (Yy/Nn)" << endl;
cin >> num;
switch(num) {
case ('Y'):
case ('y'):
return main;
break;
case ('N'):
case ('n'):
break;
}
system ("pause");
return 0;
}
```