Portál AbcLinuxu, 31. října 2025 07:41
long fak(a) {
   return a * fak(a-1);
}
            Řešení dotazu:
 11.8.2011 16:20
AraxoN             | skóre: 47
             | blog: slon_v_porcelane
             | Košice
        11.8.2011 16:20
AraxoN             | skóre: 47
             | blog: slon_v_porcelane
             | Košice
        Teoreticky 0, ale prakticky zadny, protoze neskonci. Respektive skonci i se zahlcenim systemu, pretecenim zasobniku nebo necim podobnym nezdravym. Nikde tam totiz nemas kontrolu na ukonceni.
Dejv
 
             
            class fakt {
public:
	fakt(long n) {
	}
};
long operator-(const fakt &a, long l) {
	throw 1L;
}
long operator*(const fakt &a, long l) {
	throw 1L;
}
long fak(const fakt &a) {
return a * fak(a-1);
}
int main(int argc, char* argv[])
{
	try {
		fak(0L);
	}
	catch (long) {
		42 ;
	}
	return 0;
}
no ten faktorial, ten by z toho sel taky vymacknout.
             
             Pro mne minimalne v tom, o jaky ma jit jazyk.
 Pro mne minimalne v tom, o jaky ma jit jazyk.
            
#include <iostream>
template<int i>
struct factorial
{
        static int const value = i * factorial<i - 1>::value;
};
template<>
struct factorial<0>
{
        static int const value = 1;
};
int main()
{
        std::cout << factorial<8>::value << "\n";
}
            (defun faktorial (n)
  (if (> n 1)
    (* n (faktorial (- n 1)))
    1))
            
constexpr int factorial(int number)
{
    return number ? number * factorial(number - 1) : 1;
}
int main()
{
    std::cout << factorial(8) << std::endl;
}
            
        Tiskni
            
                Sdílej:
                 
                 
                 
                 
                 
                 
            
    
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.