Hello, I'm trying to create a program to calculate the factorial of variable int input. I am using xcode, and it's giving me an error saying "factorial was not declared in this scope" on the line within the else statement. I have found other programs on the internet, but I would simply like to understand why mine won't work. I would be grateful for any constructive suggestions or comments.
Thanks.
Here is what I have so far:
#include <iostream>
using namespace std;
int main(int input)
{
cin >> input;
if (input == 0)
{
cout << "1" << endl;
}
else
{
cout << factorial << endl;
}
}
int factorial(int input)
{
cin >> input;
input * (input - 1);
}