fork(1) download
  1. #include <iostream>
  2. #include <limits>
  3.  
  4.  
  5. int main() {
  6. //print maximum of various types
  7. std::cout << "Maximum values :\n";
  8. std::cout << "Short : " << std::numeric_limits<short>::max() << std::endl;
  9. std::cout << "Int : " << std::numeric_limits<int>::max() << std::endl;
  10. std::cout << "Long : " << std::numeric_limits<long>::max() << std::endl;
  11. std::cout << "Long Long: " << std::numeric_limits<long long>::max() << std::endl;
  12. std::cout << "Float : " << std::numeric_limits<float>::max() << std::endl;
  13. std::cout << "Double : " << std::numeric_limits<double>::max() << std::endl;
  14.  
  15. //print minimum of various types
  16. std::cout << "\n";
  17. std::cout << "Minimum Values: \n";
  18. std::cout << "Short : " << std::numeric_limits<short>::min() << std::endl;
  19. std::cout << "Int : " << std::numeric_limits<int>::min() << std::endl;
  20. std::cout << "Long : " << std::numeric_limits<long>::min() << std::endl;
  21. std::cout << "Long Long: " << std::numeric_limits<long long>::min() << std::endl;
  22. std::cout << "Float : " << std::numeric_limits<float>::min() << std::endl;
  23. std::cout << "Double : " << std::numeric_limits<double>::min() << std::endl;
  24. }
Success #stdin #stdout 0.02s 2684KB
stdin
Standard input is empty
stdout
Maximum values :
Short : 32767
Int : 2147483647
Long : 2147483647
Long Long: 9223372036854775807
Float : 3.40282e+38
Double : 1.79769e+308

Minimum Values: 
Short : -32768
Int : -2147483648
Long : -2147483648
Long Long: -9223372036854775808
Float : 1.17549e-38
Double : 2.22507e-308