C++ dasturida faqat C++03 xususiyatlaridan foydalangan holda kompilyatsiya vaqtida sonning faktorialini hisoblaydigan dastur: #include <iostream> shablon<int N> struct Factorial { enum { value = N * Factorial<N - 1>::value }; }; template<> struct Factorial<0> { enum { value = 1 }; }; int main ((() { std::cout << Factorial<5>::value << std::endl; return 0; } Ushbu dastur faktorialni hisoblash uchun rekursiv shablon tuzilmasidan foydalanadi. N 0 bo'lgan holatda faktorial shablonning ixtisoslashuvi 1. Umumiy shablon N faktorialni N (N 1) bilan ko'paytirish orqali hisoblaydi, bu esa N faktorial shablonni rekursiv ravishda N - 1 bilan hisoblash orqali hisoblanadi
spam fails_task lang_mismatch pii not_appropriate hate_speech sexual_content quality toxicity humor helpfulness creativity violence