हिंदी माध्यम नोट्स
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 करते है |
Recent Posts
सती रासो किसकी रचना है , sati raso ke rachnakar kaun hai in hindi , सती रासो के लेखक कौन है
सती रासो के लेखक कौन है सती रासो किसकी रचना है , sati raso ke…
13 hours ago
मारवाड़ रा परगना री विगत किसकी रचना है , marwar ra pargana ri vigat ke lekhak kaun the
marwar ra pargana ri vigat ke lekhak kaun the मारवाड़ रा परगना री विगत किसकी…
13 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