JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now

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

Categories: c++ language in hindi

C++ : Program Format in programming language in hindi , c++ program format in hindi

c++ program format in hindi , C++ : Program Format in programming language in hindi :-
जब c++ मे किसी function को बनाते है प्रोग्राम को major parts मे डिवाइड किया जाता है और इन function को design किया जाता है |इसमें निन्म sections होता है :-
1.Comments जो की // prefix से indicate होता है |
2. Pre processor जो की #include से मेंशन होता है |
3.Function header : int main()
4.Namespace directive
5.A function body
6.Statements जो की output statement को perform करते है |
7.A return statement
इसके अलावा main() function को निन्म प्रकार से define करते है |
int main()
{
statement;
return 0;
}
इस उदहारण मे , function का नाम main() है जिसका return type integer है |इससे function definition कहते है | function definition  के दो भाग होते है :-
1.int main() : इससे function header कहते है | या इसे function interface कहते है |ये प्रोसेस define करते है जो इस function को बाकि के function से लिंक को declare करता है |
2.function body : इसे {} से क्लोज होते है | जो की function के statements को define करता है |इस body मे , एक complete instruction को statement कहते है |इस statement को semicolon से terminate करते है |

          C++ Program Format

Statement
एक statement , एक complete instruction को define करता है |अगर किसी source code को run करते है तब compiler एक statement को perform करने के बाद दूसरा statement perform होता है |इन दोनों स्त्स्तेमेंट को किसी प्रकार के syntax से differentiate करते है |जैसे
FORTRAN: Statement को अलग अलग करने  के लिए end of line  को use किया जाता है |
Prascal : इसमें colon को use नहीं किया जाता है |
C++ : इसमें semicolon को use किया जाता है |
C++ Comment
C++ को double dash (//) से define किया किया है |comment को किसी प्रोग्राम के statement को प्रोग्रामर को सामने के लिए extra information को define करता है |complier comment को ignore करता है |C++ मे भी एस होता है | उदाहरण के लिए :-
#include<iostream>
void main()

 

{
using namespace std;

 

cout<< My first program ;
cout<< Parth;
getch();
}
C++ comment ‘//’ से start होता है और line के end तक चलता है |उदहारण के लिए
#include<iostream>
void main()

 

{
using namespace std;

 

cout<< My first program ;  // display message
cout<< Parth;
getch();
}
इस कोर्स मे , comment को bold मे लिखा जाता है |
Preprocessor
जब किसी c++ प्रोग्राम मे input और output statement को use किया जाता है तो
#include<iostream.h>
using namespace std;
statements को use किया जाता है |अगर compiler को इन दोनों lines को compile नहीं करता है तब इस single statement को भी use कर सकते है |
#include<iostream.h>
C++ Pre processor को use किया जाता है |जो की प्रोग्राम मे use की जाने वाली source file को define करता है|C++ translator c++ प्रोग्राम को c प्रोग्राम मे convert करता है |यह पर #include एक directive है जको की <> मे लिखे source file को लिंक करते है |directive से source file मे लिखे content प्रोग्राम मे add किया जाता है |
iostream.h मे i का मतलब  input है और o का मतलब output होता है |इस file बहुत सारे function include होते है |जैसे
cout : console screen पर data को print करने के लिए |
cin : यूजर द्वारा input की जाने वाले input को read करने के लिए use किया जाता है |
iostream.h को modify नहीं कर सकते है |इसे main() function मे केवल use कर सकते है |
Header file name :
#include <iostream.h> मे iostream , source file का नाम है | iostream.h को header file कहते है |C++ मे कई सारे header files होती है |जो की बहुत सारे functions की definition को hold करता है|C language मे  header file को ‘h’ से define करते है |उदाहरण के लिए :
math function के लिए math.h को इस्तेमाल करता है |
लेकिन c++ मे ‘h’ extension को use नहीं भी कर सकते है |c header file को c++ मे भी use कर सकते है |लेकिन इस file को rename किया जाता है जैसे
math.h को c++ मे cmath को use किया जाता है जो की math के बहुत सारे functions को use किया जाता है |
header file name
old style
new style
Comments
iostream
iostream .h
iostream
Input /output
Math
Math.h
Cmath
Math operation
String
string.h
cstring
String operation
Conio
Conio.h
cconio
Conio function

 

Namespace
अगर iostream .h की जगह iostream  को use किया जाता है तब name space को use किया जाता है |इसका syntax है :
using namespace std ;
इसे directive कहते है |इस statement  का use memory management के लिए किया जाता है|
name space c++ का नया feature है जो की c++ मे combine करना complusy होता है |
COUT
इस function का use console screen पर आउटपुट statement को print करने के लिए किया जाता है |इसका उदाहरण है :-
cout << “good  morning” ;
statement का जो पार्ट double quotes “” मे close होता है उसे message कहते है |इस statement मे good  morning एक character string है जो की console screen पर  print होता है | << नोटेशन का use string को console function मे सेंड किया जाता है |इसमें string के फ्लो की डायरेक्शन को define करता है |
C++ : Program Format  मे प्रोग्राम format के तीन मतवपूर्ण भागो को discuss किया है अब आगे वाले article मे बाकि के तीन भागो को discuss करते है |
Sbistudy

Recent Posts

मालकाना का युद्ध malkhana ka yudh kab hua tha in hindi

malkhana ka yudh kab hua tha in hindi मालकाना का युद्ध ? मालकाना के युद्ध…

4 weeks ago

कान्हड़देव तथा अलाउद्दीन खिलजी के संबंधों पर प्रकाश डालिए

राणा रतन सिंह चित्तौड़ ( 1302 ई. - 1303 ) राजस्थान के इतिहास में गुहिलवंशी…

4 weeks ago

हम्मीर देव चौहान का इतिहास क्या है ? hammir dev chauhan history in hindi explained

hammir dev chauhan history in hindi explained हम्मीर देव चौहान का इतिहास क्या है ?…

1 month ago

तराइन का प्रथम युद्ध कब और किसके बीच हुआ द्वितीय युद्ध Tarain battle in hindi first and second

Tarain battle in hindi first and second तराइन का प्रथम युद्ध कब और किसके बीच…

1 month ago

चौहानों की उत्पत्ति कैसे हुई थी ? chahamana dynasty ki utpatti kahan se hui in hindi

chahamana dynasty ki utpatti kahan se hui in hindi चौहानों की उत्पत्ति कैसे हुई थी…

1 month ago

भारत पर पहला तुर्क आक्रमण किसने किया कब हुआ first turk invaders who attacked india in hindi

first turk invaders who attacked india in hindi भारत पर पहला तुर्क आक्रमण किसने किया…

1 month 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