fork download
  1. #include <iostream>
  2. #include <limits>
  3. using namespace std;
  4.  
  5. int main() {
  6. cout <<"char: size=" << sizeof(char)
  7. <<" bytes, min=" << int(numeric_limits<char>::min())
  8. <<", max=" << int(numeric_limits<char>::max()) << endl;
  9.  
  10. cout <<"char: size=" << sizeof(char)
  11. <<" bytes, min=" << int(numeric_limits<char>::min())
  12. <<", max=" << int(numeric_limits<char>::max()) << endl;
  13.  
  14. cout <<"int: size=" << sizeof(int)
  15. <<" bytes, min=" << numeric_limits<int>::min()
  16. <<", max=" << numeric_limits<int>::max() << endl;
  17.  
  18. cout <<"float: size=" << sizeof(float)
  19. <<" bytes, min=" << numeric_limits<float>::min()
  20. <<", max=" << numeric_limits<float>::max() << endl;
  21.  
  22. cout <<"double: size=" << sizeof(double)
  23. <<" bytes, min=" << numeric_limits<double>::max() << endl;
  24.  
  25. return 0;
  26. }
Success #stdin #stdout 0s 5316KB
stdin
Standard input is empty
stdout
char: size=1 bytes, min=-128, max=127
char: size=1 bytes, min=-128, max=127
int: size=4 bytes, min=-2147483648, max=2147483647
float: size=4 bytes, min=1.17549e-38, max=3.40282e+38
double: size=8 bytes, min=1.79769e+308