fork(2) download
  1. #include <iostream>
  2. #include <boost/preprocessor/repetition/enum.hpp>
  3.  
  4. #define MODER 10
  5.  
  6. template<int a, int n> struct pow
  7. {
  8. static const int value = a * pow<a, n-1>::value % MODER;
  9. };
  10. template<int a> struct pow<a, 0>
  11. {
  12. static const int value = 1;
  13. };
  14.  
  15. #define ORDER(count, i, data) pow<data,i>::value
  16.  
  17. int main() {
  18. const int p = 3;
  19. int const a[] = { BOOST_PP_ENUM(10, ORDER, p) };
  20. std::size_t const n = sizeof(a)/sizeof(int);
  21. for(std::size_t i = 0 ; i != n ; ++i )
  22. std::cout << a[i] << "\n";
  23. return 0;
  24. }
Success #stdin #stdout 0.02s 2680KB
stdin
Standard input is empty
stdout
1
3
9
7
1
3
9
7
1
3