Skip to content

Instantly share code, notes, and snippets.

@abcsharp
Created October 15, 2011 17:08
Show Gist options
  • Save abcsharp/1289851 to your computer and use it in GitHub Desktop.
Save abcsharp/1289851 to your computer and use it in GitHub Desktop.
ラムダ式で階乗を求めるやつ
#include <functional>
#include <iostream>
using std::function;
using std::cout;
int main(void)
{
function<int(int)> LambdaFactorial=[&](int n)->int{!n?1:n*LambdaFactorial(n-1);};
cout<<LambdaFactorial(5);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment