fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. namespace my {
  5. template <typename T>
  6. T max(const T& lhs, const T& rhs) {
  7. return lhs > rhs ? lhs : rhs;
  8. }
  9. }
  10.  
  11. int main(void) {
  12. // your code goes here
  13.  
  14. double zero = 0.0;
  15. double nzero = -0.0;
  16. cout << "zero\t\t= " << zero << endl;
  17. cout << "nzero\t\t= "<< nzero << endl;
  18. cout << "my::max\t\t= " << my::max(zero, nzero) << endl;
  19. cout << "std::max\t= " << max(zero, nzero) << endl;
  20. return 0;
  21. }
  22.  
Success #stdin #stdout 0s 3412KB
stdin
Standard input is empty
stdout
zero		= 0
nzero		= -0
my::max		= -0
std::max	= 0