fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. template<class T, class Ret = double>
  5. constexpr Ret square(T x)
  6. {
  7. return x*x;
  8. }
  9.  
  10. int main() {
  11. constexpr int x = 17;
  12. constexpr double y = 17;
  13.  
  14. constexpr double max1 = square(x);
  15. constexpr double max2 = square(y);
  16.  
  17. std::cout << "Max1 = " << max1
  18. << "\nMax2 = " << max2;
  19. // your code goes here
  20. return 0;
  21. }
Success #stdin #stdout 0s 4556KB
stdin
Standard input is empty
stdout
Max1 = 289
Max2 = 289