fork(2) download
  1. #include <cstdint>
  2. #include <iostream>
  3.  
  4. constexpr uint32_t pow14(uint8_t base, uint32_t N) {
  5. uint32_t rv = 1;
  6. while(N != 0) {
  7. rv *= base;
  8. N -= 1;
  9. }
  10. return rv;
  11. }
  12.  
  13. constexpr uint32_t pow11(uint8_t base, uint32_t N) {
  14. return N == 0 ? 1 : base * pow11(base, N - 1);
  15. }
  16.  
  17.  
  18. int main() {
  19. constexpr auto p1 = pow14(2, 10);
  20. constexpr auto p2 = pow11(2, 10);
  21. std::cout << p1 << " " << p2 << std::endl;
  22. return 0;
  23. }
Success #stdin #stdout 0s 4444KB
stdin
Standard input is empty
stdout
1024 1024