Chapter 1C++ Tutorial~2 min read
Introduction to C++
C++ म्हणजे काय?
C++ ही Bjarne Stroustrup यांनी 1980 च्या दशकात Bell Labs मध्ये C ची extension म्हणून बनवली. C++ मध्ये C चे सगळे features आहेत + Object Oriented Programming (OOP) आहे. "C with Classes" असे सुरुवातीला म्हणत.
Marathi Analogy
C म्हणजे सायकल — fast, simple, manual. C++ म्हणजे motorcycle — सायकल सारखीच base, पण more power, more features! C++ मध्ये OOP म्हणजे motorcycle ला GPS, ABS, cruise control — extra capabilities.
C vs C++ — फरक
- ▸C — Procedural, functions-based. C++ — Procedural + OOP दोन्ही.
- ▸C — No classes/objects. C++ — Classes, inheritance, polymorphism.
- ▸C — Manual memory only. C++ — new/delete + smart pointers.
- ▸C — No function overloading. C++ — Overloading + templates.
- ▸C — No references. C++ — References (&) support.
- ▸C++ — cin/cout. C — printf/scanf.
C++ कुठे वापरतात?
- ▸Game Engines — Unreal Engine, Unity (partly) C++ मध्ये
- ▸Operating Systems — Windows, macOS kernel parts
- ▸Browsers — Chrome, Firefox C++ मध्ये लिहिले
- ▸Databases — MySQL, MongoDB
- ▸Embedded Systems — Cars, IoT devices
- ▸Competitive Programming — Speed साठी #1 choice
- ▸Finance — High-frequency trading systems
C++ चा पहिला program
cpp
#include <iostream> // Input/Output साठी header
using namespace std; // std:: prefix नको म्हणून
int main() {
// cout — console output
cout << "नमस्कार! C++ मध्ये स्वागत! 🔷" << endl;
cout << "Hello, World!" << endl;
// Basic arithmetic
int a = 10, b = 3;
cout << a << " + " << b << " = " << a + b << endl;
cout << a << " / " << b << " = " << a / b << endl; // 3
cout << a << " % " << b << " = " << a % b << endl; // 1
return 0; // 0 = success
}💡
C++ install करायला g++ compiler लागतो. Linux/Mac — terminal मध्ये g++ आधीच असतो. Windows — MinGW install करा किंवा VS Code + C++ extension वापरा. Compile: g++ file.cpp -o file, Run: ./file
✅ Key Points — लक्षात ठेवा
- ▸C++ = C + OOP — Bjarne Stroustrup, 1980s
- ▸#include <iostream> + using namespace std — boilerplate
- ▸cout << "text" << endl — output
- ▸cin >> variable — input
- ▸int main() { return 0; } — entry point
0/11 chapters पूर्ण