JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now

हिंदी माध्यम नोट्स

Class 6

Hindi social science science maths English

Class 7

Hindi social science science maths English

Class 8

Hindi social science science maths English

Class 9

Hindi social science science Maths English

Class 10

Hindi Social science science Maths English

Class 11

Hindi sociology physics physical education maths english economics geography History

chemistry business studies biology accountancy political science

Class 12

Hindi physics physical education maths english economics

chemistry business studies biology accountancy Political science History sociology

Home science Geography

English medium Notes

Class 6

Hindi social science science maths English

Class 7

Hindi social science science maths English

Class 8

Hindi social science science maths English

Class 9

Hindi social science science Maths English

Class 10

Hindi Social science science Maths English

Class 11

Hindi physics physical education maths entrepreneurship english economics

chemistry business studies biology accountancy

Class 12

Hindi physics physical education maths entrepreneurship english economics

chemistry business studies biology accountancy

Categories: c++ language in hindi

C++ : Integer Type in computer programming , what is and how many Integer in c++ language in hindi

what is and how many Integer in c++ language in hindi , C++ : Integer Type in computer programming :-
computer memory मे यूनिट्स होती है जिसे bits कहते है |अतः integer type के अलग अलग data type को अलग अलग values को store करते है |C++ मे , तीन प्रकार के modifier है :
1-short
short integer कम कम से 16 bits width के integer को store करता है |
2.int
int , short type से थोडा ज्यादा width के integer value को store करता है |
3.long
long integer कम कम से 32 bits width के integer को store कर सकता है |
कई सारे सिस्टम मे integer type मे कई options को देते है |जैसे
IBM PC के लिए integer के लिए 16 बिट होता है |
वही पर window सिस्टम के लिए 32 bits  होता है |
निन्म variable को नीचे प्रकार से declare कर सकते है :-
short age;  // short type declaration
int salary; // integer type declaration
long position; // long type declaration
तीनो integer type signed type है | सभी की range को positive और negative integer को सामान मे बाट दिया जाता है |16 bit int run – 32,768 to  32,767 |
sizeof() operator का use ,integer variable के size को calculate करने के लिए किया जाता है | उदाहरण के लिए :
#include<iostream>
#include<climits>
void mian()
{
using namrespace std;
int n_int=INT_MAX;
short n_short = SHRT_MAX;
long n_long = LONG_MAX;
cout<<“int is”<<sizeof (int) << Endl;
cout<<“short is “<<sizeof n_short <<endl;
cout<<“long is “<< sizeof n_long<<endl;
cout<<“Maximum Value”<<endl;
cout<<“int :”<<n_int<<endl;
cout<<“short :”<<n_short<<endl;
cout<<“long :”<<n_long<<endl;
getch();
}
sizeof() operator
sizeof() operator का integer variable के size को calculate करने के लिए किया जाता है |इसका syntax होता है :
sizeof( variable );
यहा पर
variable : variable / type हो सकता है |अगर आप किसी variable के नाम को sizeof() operator के साथ use करते है तो () ऑप्शनल है |
यहा पर sizeof() operator , climits header file मे store है |इसके अलवा climits मे constant होता है :-
char_bit
NUMBER OF BITS IN CHAR
CHAR_MAX
MAXIMUM CHAR VALUE
CHAR_MIN
MINIMUM CHAR VALUE
SCHAR_MAX
MAXIMUM SIGNED CHAR VALUE
SCHAR_MIN
MINIMUM SIGNED CHAR VALUE
UCHAR_MAX
MAXIMUM UNSIGNED CHAR VALUE
SHRT_MAX
MAXIMUM SHORT VALUE
SHRT_MIN
MINIMUM SHORT VALUE
USHART_MAX
MAXIMUM UNSIGNED SHORT VALUE
INT_MAX
MAXIMUM INT VALUE
INT_MIN
MINIMUM INT VALUE
LONG_MAX
MAXIMUM LONG VALUE
LONG_MIN
MINIMUM LONG VALUE
ULONG_MAX
MAXIMUM UNSIGNED LONG VALUE
UINT_MAX
MAXIMUM UNSIGNED INT VALUE
Initialization
Initialization statement मे assignment operator के साथ declaration को combine करता है |उदाहरन के लिए int max = 5;
यहा पर max integer type variable है जिसमे value ‘5’ को assign किया गया है |c++ मे किसी variable से दुसरे variable को initial कर सकते है |दुसरे variable को सबसे पहले initial करना होता है |
अतः आप इस initial statement को expression मे use कर सकते है
उदाहरण के लिए
#include<iostream>
#include<climits>
void mian()
{
using namrespace std;
int a=5;
int b=a;
int c=a+b+10;
cout<<“value of a”<<a<<endl;
cout<<“value of b”<<b<<endl;
cout<<“value of c”<<c<<endl;
getch();
}
इस उदाहरन मे , ‘a’ को सबसे पहले initial किया गया है और बाद मे इसे b मे assign किया गया है | इस statement के अलावा C++ मे निन्म पत्रकार से initial statement को लिखा जा सकता है |
int a(5);
int b(a);
unsigned types
सभी तीन integer का एक और प्रकार होता है जिसे unsigned कहते है |unsigned type एसे type होता है जो की negative value को hold नहीं कर सकते है |अतः इस प्रकार integer के range भी बढ़ जाती है |उदाहरण के लिए
short integer की range – 32,768 to  32,767 होती है लेकिन unsigned short integer की range 0 से 65,535 होती है |लेकिन unsigned type को केवल उस case मे solve किया जा सकता है जिसमे कभी भी value negative ना हो |Unsigned type का declaration निन्म प्रकार से होता है |
unsigned short age;
unsigned long age;
unsigned int age;
unsigned age;
Choosing an integer type
c++ मे integer type मे variety होने के कारन ,integer type को चुनना मुश्किल होता है |Normal integer को कंप्यूटर efficiently handel कर लेते है |
जब तक कोई और requirement न हो तब तक नार्मल integer को use करना चाहिए | अगर value कभी negatative नहीं होगी तब sunsigned integer को use किया जा सकता है |अगर value की size 16 बिट से ज्यादा हो तब long type को use करना चाहिए |
short type को तब use करना चाहिए जब large number ऑफ़ value की array को store करना चाहिए |इससे storage को कम किया जा सकता है |
अलग अलग कंप्यूटर सिस्टम के लिए अलग अलग size होती है |जैसे DOS के लिए int की size 16 बिट ,XP के लिए int की size 32 बिट होती है |
Integer Constant
C++ मे , तीन base सिस्टम होता है | 10,8,और 16 | C++ मे किसी value के first और दो डिजिट से number base को identify किया जाता है |
अगर first और दो डिजिट , 0-9 के बीच मे होते है तब इसे decimal number सिस्टम कहते है|
अगर first और दो डिजिट 0x होते है तब base सिस्टम hexadecimal कहते है |
अगर first डिजिट ‘0’ होता है तब base सिस्टम octal होता है |
उदाहरण के लिए :
#include<iostream>
#include<climits>
void mian()
{
using namrespace std;
int a=52;
int b=0x34;
int c=042;
cout<<“value of a”<<a<<endl;
cout<<“value of b”<<b<<endl;
cout<<“value of c”<<c<<endl;
getch();
}
इस उदाहरण मे , a मे assign होने वाली value decimal है | b मे assign होने वाली value hexadecimal है |c मे assign होने वाली value octal है |
iostream header file मे कुछ manipulators होते है base सिस्टम को interchage कर सकते है |जैसे
1.dec: इसका use decimal base के लिए किया जाता है |
2.hex :इसका use hexadecimal base के लिए किया जाता है |
3.oct :इसका use octal base के लिए किया जाता है |
इसे endl की तरह use किया जाता है| इससे value को print करने से पहले declare किया जाता है |
उदहारण के लिए:
#include<iostream>
#include<climits>
void mian()
{
using namrespace std;
int a=52;
cout<<dec;
cout<<“Decimal value of a”<<a<<endl;
cout<<hex;
cout<<“hexadecimal value of a”<<a<<endl;
cout<<oct;
cout<<“octal value of a”<<a<<endl;
getch();
}
इस आर्टिकल मे integer के type , initial , constant को discuss किया है | आगे के article मे , charecter को discuss करेगे |
Sbistudy

Recent Posts

four potential in hindi 4-potential electrodynamics चतुर्विम विभव किसे कहते हैं

चतुर्विम विभव (Four-Potential) हम जानते हैं कि एक निर्देश तंत्र में विद्युत क्षेत्र इसके सापेक्ष…

2 days ago

Relativistic Electrodynamics in hindi आपेक्षिकीय विद्युतगतिकी नोट्स क्या है परिभाषा

आपेक्षिकीय विद्युतगतिकी नोट्स क्या है परिभाषा Relativistic Electrodynamics in hindi ? अध्याय : आपेक्षिकीय विद्युतगतिकी…

4 days ago

pair production in hindi formula definition युग्म उत्पादन किसे कहते हैं परिभाषा सूत्र क्या है लिखिए

युग्म उत्पादन किसे कहते हैं परिभाषा सूत्र क्या है लिखिए pair production in hindi formula…

6 days ago

THRESHOLD REACTION ENERGY in hindi देहली अभिक्रिया ऊर्जा किसे कहते हैं सूत्र क्या है परिभाषा

देहली अभिक्रिया ऊर्जा किसे कहते हैं सूत्र क्या है परिभाषा THRESHOLD REACTION ENERGY in hindi…

6 days ago

elastic collision of two particles in hindi definition formula दो कणों की अप्रत्यास्थ टक्कर क्या है

दो कणों की अप्रत्यास्थ टक्कर क्या है elastic collision of two particles in hindi definition…

6 days ago
All Rights ReservedView Non-AMP Version
X

Headline

You can control the ways in which we improve and personalize your experience. Please choose whether you wish to allow the following:

Privacy Settings
JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now