fork(1) download
  1. #include <iostream>
  2. #include <functional>
  3.  
  4. int main() {
  5. std::function<int(int)> fac = [&fac](int x){ return x > 0 ? x * fac(x-1) : 1; };
  6. std::cout << fac(5) << std::endl;
  7. return 0;
  8. }
Success #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
120