Created
October 15, 2011 17:08
-
-
Save abcsharp/1289851 to your computer and use it in GitHub Desktop.
ラムダ式で階乗を求めるやつ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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