Last active
May 13, 2019 09:07
-
-
Save socketbox/0692c53acd90828859d9cb14f3acdba5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <stdio.h> | |
#include <limits> | |
int main() | |
{ | |
std::cout << "Integers: \n"; | |
std::cout << "\tType\t\tSize (Bits)\tLowest\t\tMin\t\tMax\n"; | |
std::cout << "____________________________________________________________________________\n"; | |
int x = 0; | |
std::cout << "\tint\t\t" << sizeof(x) * 8 << "\t\t" | |
<< std::numeric_limits<int>::lowest() << '\t' | |
<< std::numeric_limits<int>::min() << '\t' | |
<< std::numeric_limits<int>::max() << '\n'; | |
long l = 0; | |
std::cout << "\tlong\t\t" << sizeof(l) * 8 << "\t\t" | |
<< std::numeric_limits<long>::lowest() << '\t' | |
<< std::numeric_limits<long>::min() << '\t' | |
<< std::numeric_limits<long>::max() << '\n'; | |
long long ll = 0; | |
std::cout << "\tlong long\t" << sizeof(ll) * 8 << "\t\t" | |
<< std::numeric_limits<long long>::lowest() << '\t' | |
<< std::numeric_limits<long long>::min() << '\t' | |
<< std::numeric_limits<long long>::max() << '\n'; | |
unsigned long ul = 0; | |
std::cout << "\tunsigned long\t" << sizeof(ul) * 8 << "\t\t" | |
<< std::numeric_limits<unsigned long>::lowest() << "\t\t" | |
<< std::numeric_limits<unsigned long>::min() << '\t' | |
<< std::numeric_limits<unsigned long>::max() << '\n'; | |
std::cout << "\nFloating-point: \n"; | |
std::cout << "\tType\t\tSize (Bits)\tLowest\t\tMin\t\tMax\n"; | |
std::cout << "____________________________________________________________________________\n"; | |
float f = 0; | |
std::cout << "\tfloat\t\t" << sizeof(f) * 8 << "\t\t" | |
<< std::numeric_limits<float>::lowest() << '\t' | |
<< std::numeric_limits<float>::min() << '\t' | |
<< std::numeric_limits<float>::max() << '\n'; | |
double d = 0; | |
std::cout << "\tdouble\t\t" << sizeof(d) * 8 << "\t\t" | |
<< std::numeric_limits<double>::lowest() << '\t' | |
<< std::numeric_limits<double>::min() << '\t' | |
<< std::numeric_limits<double>::max() << '\n'; | |
long double ld = 0; | |
std::cout << "\tlong double\t" << sizeof(ld) * 8 << "\t\t" | |
<< std::numeric_limits<double>::lowest() << '\t' | |
<< std::numeric_limits<double>::min() << '\t' | |
<< std::numeric_limits<double>::max() << '\n'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment