This is my first time using the boost library in c++ and I wanted to try out the factorial function in the math section.
#include <iostream>
#include <boost/math/special_functions/factorials.hpp>
using namespace std;
using namespace boost::math;
int main() {
double i;
cout << "Please enter your number: ";
cin >> i;
cout << "The factorial of " << i << " is equal to " << factorial<double>(i) << endl;
return 0;
}
Is the code good for a first time? What changes should I make? Am I using the factorial function to its maximum potential?(Because there is so much info on the factorials.hpp file description found on boost : https://www.boost.org/doc/libs/1_70_0/libs/math/doc/html/math_toolkit/factorials/sf_factorial.html)
Aucun commentaire:
Enregistrer un commentaire