Browse Source

limits

master
DEW 9 months ago
parent
commit
cbcab53156
  1. BIN
      limits
  2. 25
      limits.cpp

BIN
limits

Binary file not shown.

25
limits.cpp

@ -0,0 +1,25 @@
#include <iostream>
#include <climits>
int main()
{
using namespace std;
int n_int = INT_MAX;
short n_short = SHRT_MAX;
long n_long = LONG_MAX;
long long n_llong = LLONG_MAX;
cout << "int is " << sizeof(int) << " bytes." << endl;
cout << "short is " << sizeof n_short << " bytes." << endl;
cout << "long is " << sizeof n_long << " bytes." << endl;
cout << "long long is " << sizeof n_llong << " bytes." << endl;
cout << endl;
cout << "Maximum values: " << endl;
cout << "int: " << n_int << endl;
cout << "short: " << n_short << endl;
cout << "long: " << n_long << endl;
cout << "long long: " << n_llong << endl
<< endl;
cout << "Minimum int value = " << INT_MIN << endl;
cout << "Bit per byte = " << CHAR_BIT << endl;
return 0;
}
Loading…
Cancel
Save