হেডার ফাইল "limits.h" C ভাষায় বিদ্যমান যখন C++ ভাষায়
“limits.h” বা
CHAR_BIT | LONG_MIN | LONG_MAX | CHAR_MIN | CHAR_MAX |
INT_MIN | INT_MAX | SHRT_MIN | SHRT_MAX | ULONG_MAX |
এখানে C++ ভাষায়
উদাহরণ
#include<iostream> #include <bits/stdc++.h> #include<climits> using namespace std; int main() { int x = 28; int a = CHAR_BIT*sizeof(x); stack<bool> s; cout << "The number is : " << x << endl; for (int i=1; i<=a; i++) { s.push(x%2); x = x/2; } cout << "The number of bits in a byte : " << CHAR_BIT << endl; for (int i=1; i<=a; i++) { cout << s.top(); s.pop(); if (i % CHAR_BIT == 0) cout << " "; } cout << "\n\nThe minimum value of short int :" << SHRT_MIN; return 0; }
আউটপুট
The number is : 28 The number of bits in a byte : 8 00000000 00000000 00000000 00011100 The minimum value of short int :-32768
উপরের প্রোগ্রামে,
int x = 28; int a = CHAR_BIT*sizeof(x); …. cout << "\n\nThe minimum value of short int :" << SHRT_MIN;