//expected result should be
//n*(n-1)*(n-2)*(n-3)...
//where n is the input value
#include<iostream.h>
#include<conio.h>
//definition of struct
struct factorial
{
long value;
long result;
long declaration;
}factorialresult;
int main()
{
clrscr();
//accepting input
cout<<"Enter value"<<endl;
cin>>factorialresult.value<<endl;
//declaration
for(factorialresult.declaration=(factorialresult.value-1); factorialresult.value<10; factorialresult.value++)
{
factorialresult.result=(factorialresult.declaration*factorialresult.declaration)
//printing the result
cout<<"Result is"<<endl;
cout<<factorialresult.result<<endl;
}
getch();
}
What you need to do is build your program step by step. Instead of trying to do it all at once.
For example: Do you really need to use a struct? In this situation it is adding un-necessary complexity to your application.
You should write you application in steps
1. Get the input from the user
2. Generate the factorial
3. Output the result.
Don't be afraid to put extra cout << statements in during the development to test that what your expecting is exactly what you're getting. My answer above gave you a simple formula in the form of a loop for generating the factorial.