/************************************************************************ ex01.cpp ************************************************************************/ #include <iostream> using namespace std; template <class T> T factoral(const T end) { T result = 1; for (int i = end; i > 1; i--) result = result * i; return result; } void main() { for (int i = 0; i < 20; i++) cout << factoral(i) << endl; cout.precision(0); cout.setf(ios::fixed); cout << endl; for (float f = 0.0; f < 20.0; f += 1.0) cout << factoral(f) << endl; }