[ create a new paste ] login | about

Link: http://codepad.org/ohNwTXOF    [ raw code | output | fork ]

C++, pasted on Dec 31:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <iostream>

int main()
{
    class Bar {
    public:
        int lastResult;
        int frac(int n) {
            if (n == 0) return 1;
            return (lastResult = n * frac(n - 1));
        }
    };

    Bar x;
    x.frac(10);
    std::cout << x.lastResult << std::endl;
}


Output:
1
3628800


Create a new paste based on this one


Comments: