JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now

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

Categories: c++ language in hindi

C++ : Statements in hindi , what are statement in c++ computer programming language in hindi

what are statement in c++ computer programming language in hindi , C++ : Statements in hindi :-
Statements किसी कंप्यूटर प्रोग्राम मे दिए जाने निर्देश को specify करता है |statement के प्रकार को समजने के लिए निन्म उदहारण को consider करेगे |
उदहारण -1
#include<iostream.h>
#include<conio.h>
void main()
{
using namespace std;
int a;
cout<<“Enter data:  “<<endl;
cin>>a;
cout<<“Your data is”<<a<<endl;
int b= a+2;
cout<<“b=a+2 is”<<b<<endl;
getch();
}
इस प्रोग्राम का आउटपुट होगा :
Enter data : 12
Your data is 12
b=a+2 is 14
इस उदाहरण मे , एक नए syntax “cin’ को introduce किया गया है जिसे console screen पर यूजर द्वारा input data को variable ‘a’ मे assign कर देता है जिसे बाद मे दो cout statement मे use किया जाता है |
Cin Statement
जैसे की आउटपुट मे दिखा देता है यूजर द्वारा ’12’ को input किया जाता है जिसे ‘a’ मे assign किया जाता है |ये operation  statement cin>>a; से होता है |
इस statement मे ,
cin : ये object है जो की stream को define करता है |
>> : ये operator है जिसे character को input stream से extract करने के लिए किया जाता है |
<< : ये operator है जिसे character को output stream से print करने के लिए किया जाता है |
a : ये variable है जिसमे extract charecter को assign किया जाता है |
cout , cin एसे object होते है जिससे यूजर द्वारा दिए गये input को variable द्वारा ले सके वाले form मे convert किया जा सकता है |
Cin or Cout Class
class एक यूजर define data types है |किसी class को define करने  के लिए कुछ इनफार्मेशन की जरुरत होती है |जो की data types को define करता है |cलास का object से एक अनोखा रिश्ता होता है |अतः class किसी data types को define करता है और object एक entity होती है जो की class के type की होती है |
उपर वाले उदहारण मे , a की property integer है अतः ये integer type data को assign कर सकता है |जिसे बाद मे addition और multiplication मे use किया जाता है |cout : एक object है जो की ostream class की property को hold करता है |ostream class की डेफिनिशन मे , ostream object द्वारा represent की जाने वाले data के type और operation को perform करते है | इसके अलावा , cin , istream class का object है |
जैसे की हम जानते है की class user define होती है लेकिन istream और ostream class को यूजर define नहीं कर सकता है |अतः ये एक function की तरह कार्य करता है इसलिए इन्हें class library भी कहते है |
iostream libarary को मॉडिफाइड कर सकते है लेकिन इसे मॉडिफाइड करना सही नहीं होता है |इसके अलावा fstream एक और file है जो की file से related operations के लिए इस्तेमाल किया जाता है |
उदहारण -2
#include<iostream.h>
#include<conio.h>
void main()
{
using namespace std;
int a,b;
cout<<“Enter data:  “<<endl;
cin>>a;
cout<<“Enter data:  “<<endl;
cin>>b;
cout<<“Your data is”<<a<<endl;
cout<<“Your data is”<<b<<endl;
int c=a+b;
cout<<” addition is”<<c<<endl;
getch();
}

आउटपुट होगा :

Enter data : 12
Enter data : 34
Your data is 12
Your data is 34

 

 

addition is 46
इस उदाहरण मे , तीन प्रकार के statements को use किया गया है |
(i) cin statement : जिसे हमने पहले discuss किया है |
(ii) cout statement : इसे भी पहले discuss कर चुके है |
(iii) Assignment statement
Assignment statement
Assignment statement का use किसी value को storage location पर store करने के लिए किया जाता है |इस उदाहरण मे
c=a+b;
assignment statement है जिससे ‘a’ और ‘b’ के addition को variable ‘c’ मे assign किया जाता है |इसका format होता है :
(i)variable : इसमें data को assign किया जाता है |
(ii) = : इसे assignment operator कहते है जिसका use किसी value / expression के value को किसी दुसरे variable के storage location मे assign किया जाता है |
(iii) value / Expression: इसमें value या कोई expression होता है |
अगर किसी assignment statement
a=b=c=99;
इस assignment statement मे
1.सबसे पहले 99 ,,variable ‘c’ मे assign होगा |
2.फिर उसके बाद variable ‘c’ की value variable ‘b’ मे assign होगी |
3.फिर उसके बाद variable ‘b’ की value variable ‘a’ मे assign होगी |
अतः assignment operator right to left डायरेक्शन मे कार्य करता है |
cout Statement clarification
cout statement को दोनों string और integer को print करने के लिए use किया जाता है लेकिन जब cout<<a; को execute किया जाता है तब a की value print होती है |
ये दो प्रकार से होता है :
(i) या तो a की value 12 से replace होती है |
(ii) या value ’12’ को output charecter मे ट्रांसलेट करे |
जैसे अगर 12 को print करना होता है तब दोनों ‘1’ और ‘2’ string के characters की तरह कार्य करता है |और इसे एक एक करके print करता है | लेकिन 12 तो एक numerical value है |इसे store करने के लिए इसे binary form मे convert किया जाता है | cout एक स्मार्ट object है जो की numerical value को binary form मे आटोमेटिक convert किया जाता है |
इसके अलावा किसी char आउटपुट statements को एक आउटपुट statement मे add किया जाता है |इसके लिए << operator को use किया जाता है |उदहारण के लिए
उदहारण -2
#include<iostream.h>
#include<conio.h>
void main()
{
using namespace std;
int a,b;
cout<<“Enter data:  “<<endl;
cin>>a;
cout<<“Enter data:  “<<endl;
cin>>b;
cout<<“Your data is”<<a<<“Your data is”<<b<<endl;
int c=a+b;
cout<<” addition is”<<c<<endl;
getch();
}
इस उदाहरण मे cout<<“Your data is”<<a<<endl; और cout<<“Your data is”<<b<<endl; को add किया गया है जिससे की एक नया statement बना है |
आउटपुट होगा :
Enter data : 12
Enter data : 34
Your data is 12 Your data is 34
addition is 46
इस article मे c++ मे use किये जाने वाले statements को discuss किया है | और आगे के article मे function को discuss करेगे |
Sbistudy

Recent Posts

सती रासो किसकी रचना है , sati raso ke rachnakar kaun hai in hindi , सती रासो के लेखक कौन है

सती रासो के लेखक कौन है सती रासो किसकी रचना है , sati raso ke…

18 hours ago

मारवाड़ रा परगना री विगत किसकी रचना है , marwar ra pargana ri vigat ke lekhak kaun the

marwar ra pargana ri vigat ke lekhak kaun the मारवाड़ रा परगना री विगत किसकी…

19 hours ago

राजस्थान के इतिहास के पुरातात्विक स्रोतों की विवेचना कीजिए sources of rajasthan history in hindi

sources of rajasthan history in hindi राजस्थान के इतिहास के पुरातात्विक स्रोतों की विवेचना कीजिए…

2 days ago

गुर्जरात्रा प्रदेश राजस्थान कौनसा है , किसे कहते है ? gurjaratra pradesh in rajasthan in hindi

gurjaratra pradesh in rajasthan in hindi गुर्जरात्रा प्रदेश राजस्थान कौनसा है , किसे कहते है…

2 days ago

Weston Standard Cell in hindi वेस्टन मानक सेल क्या है इससे सेल विभव (वि.वा.बल) का मापन

वेस्टन मानक सेल क्या है इससे सेल विभव (वि.वा.बल) का मापन Weston Standard Cell in…

3 months ago

polity notes pdf in hindi for upsc prelims and mains exam , SSC , RAS political science hindi medium handwritten

get all types and chapters polity notes pdf in hindi for upsc , SSC ,…

3 months 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