Overview
इस वीडियो में C++ प्रोग्रामिंग की पूरी शुरुआत से अंत तक विस्तार से समझाई गई है, जिसमें installation, syntax, data types, variables से लेकर object oriented programming तक सभी महत्वपूर्ण विषय कवर किए गए हैं।
C++ का परिचय और Installation
- C++ एक general purpose, statically typed, object oriented programming भाषा है, जिसे 1979 में Bjarne Stroustrup ने बनाया।
- C++ को C का superset कहा जाता है, जिसमें object oriented features जोड़े गए हैं।
- प्रोग्रामिंग के लिए Visual Studio Code (VS Code) IDE और MinGW C++ compiler install करें।
- कम्पाइलर इंस्टाल करने के बाद उसके path को system variables में सेट करना आवश्यक है।
प्रोग्राम स्ट्रक्चर और बेसिक Syntax
- .cpp extension में source code लिखा जाता है, जिसे compile करके .exe file बनाई जाती है।
- पहला प्रोग्राम:
#include <iostream>
, using namespace std;
, int main()
, cout<<"Hello World";
, return 0;
- Code को रन करने के लिए run बटन या टर्मिनल में G++ main.cpp लिखें।
Data Types, Variables और Comments
- मुख्य data types: int, float, double, char, string।
- Variables case-sensitive होते हैं, letter या underscore से शुरू हो सकते हैं।
- Camel Case Notation: जैसे marksInMaths।
- कमेंट्स डालने के लिए // या /* */ का प्रयोग करें।
Input/Output और ऑपरेटर्स
- Input के लिए
cin
, Output के लिए cout
।
- Arithmetic operators: +, -, *, / । Division में type-casting का प्रयोग करें।
- Logical, bitwise, and अन्य operators C++ में उपलब्ध हैं।
Control Flow: If-Else & Switch
- If-else, else if, और else से decision making की जाती है।
- Switch-case का प्रयोग वैल्यू के आधार पर multiple विकल्प चुनने के लिए करें।
- हर case के बाद break statement लगाना जरूरी है।
Loops
- While loop: कंडीशन true रहने तक चलता है।
- Do-while loop: कम-से-कम एक बार चलता है, फिर कंडीशन चेक करता है।
- For loop: initialization, condition, increment/decrement के साथ repetitive tasks के लिए।
Functions
- Functions reusable code blocks हैं, जैसे int add(int a, int b)।
- Function को main या अन्य functions से call किया जा सकता है।
- Functions parameters ले सकते हैं और value return कर सकते हैं।
Arrays & Type Casting
- Array: एक जैसे data type के collection के लिए।
- 1D और 2D arrays समझाए गए हैं।
- Type casting: एक data type को दूसरे में बदलना, जैसे float(a), int(b)।
Strings
- string एक विशेष data type है, functions जैसे length(), substr() आदि प्रयोग कर सकते हैं।
- String के साथ <string> header file जरूरी है।
Pointers
- Pointer एक विशेष variable है जो किसी variable का address store करता है।
-
- (dereferencing operator) द्वारा pointer की value access की जा सकती है।
- & (address of operator) variable का address देता है।
Object Oriented Programming (OOP): Classes & Objects
- Class एक ब्लूप्रिंट है, Object उसका उदाहरण।
- Public, private, protected access modifiers: public सभी जगह accessible, private केवल class के अंदर, protected subclass में भी।
- Constructor function: object बनते ही call होता है, variable initialize करता है।
- Inheritance: एक class दूसरी class के गुण ले सकती है।
Key Terms & Definitions
- IDE — प्रोग्राम लिखने का software (जैसे VS Code)।
- Compiler — source code को machine code में बदलने वाला tool।
- Variable — डेटा स्टोर करने का नामित स्थान।
- Function — कार्य को करने वाला कोड ब्लॉक।
- Pointer — variable का address रखने वाला variable।
- Class — OOP में blueprint/template।
Action Items / Next Steps
- C++ compiler और VS Code इंस्टॉल करें।
- Video में बताए गए code segments खुद लिखें और run करें।
- Operators, loops, functions, arrays, pointers की प्रैक्टिस करें।
- अगले भाग के लिए नोटिफिकेशन ऑन करें और कमेंट में अपनी query डालें।