Factorial calculator in C++