That's pretty much it, except
1) main() is anint, so always use int main() .
2) Watch your formatting . Be consistent.
This section
while ( i <= num ) // factorial
{
result *= i ;
i++ ;
}
cout << num << " ! = " << result ;
cin.get () ;
}
should be
while ( i <= num ) // factorial
{
result *= i ;
i++ ;
}
cout << num << " ! = " << result ;
cin.get () ;
}
You are using SPACEs to indent -- excellent!! Switch to 4 though, not 5.
WaltP
Posting Sage w/ dash of thyme
10,505 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944