🟢 Foundation  ·  Lesson 01

Introduction to C++

What is C++?

C++ is a general-purpose programming language that grew out of C. It keeps C's speed and low-level control, and adds powerful tools for organising larger programs — most famously object-oriented programming with classes and objects. In short, C++ lets you write code that is both fast and well-structured.

Because it sits close to the hardware yet supports high-level ideas, C++ is a favourite wherever performance and control both matter.

A short history

C++ was created by Bjarne Stroustrup at Bell Labs. He started it in 1979 as "C with Classes" and the language was renamed C++ in 1983 — the ++ is C's own "add one" operator, hinting that C++ is "C, incremented." It has been standardised repeatedly, and modern versions like C++11, C++17 and C++20 keep adding useful features.

Why learn C++?

  • It teaches both procedural and object-oriented programming, so it broadens how you think about code.
  • It is extremely fast, which is why it is used in games, browsers and systems software.
  • It is a top choice in competitive programming thanks to its speed and the Standard Template Library.
  • Understanding C++ makes many other languages easier, since so many borrow its ideas.

Key features

FeatureWhat it gives you
Object-oriented programmingClasses and objects to model real things
Speed and controlClose-to-hardware performance like C
Standard Template LibraryReady-made containers and algorithms
Function overloading & templatesWrite flexible, reusable code
Rich standard libraryTools for I/O, strings, math and more

A first look at C++ code

Here is a tiny complete C++ program. Do not worry about every detail yet — later lessons explain each part.

main.cpp
#include <iostream>
using namespace std;

int main() {
    cout << "Welcome to C++!" << endl;
    return 0;
}
Output:
Welcome to C++!
  • #include <iostream> brings in input/output features.
  • main() is where the program starts.
  • cout prints text to the screen; endl ends the line.

You will write and run this yourself in the first C++ program lesson, after setting up a compiler.

Where C++ is used

  • Games and game engines (like Unreal Engine)
  • Operating systems and device drivers
  • Browsers and databases
  • Competitive programming and high-performance computing
  • Embedded systems and financial trading platforms

How this course is organised

We start with the basics — setting up a compiler, writing your first program, variables, input/output, loops and functions. Then we move to what makes C++ special: object-oriented programming (classes, inheritance, polymorphism) and the Standard Template Library. Each lesson has code you can run and practise with.

Summary

  • C++ is a fast, general-purpose language built as an extension of C.
  • It adds object-oriented programming, templates and the STL to C's speed.
  • Bjarne Stroustrup created it; modern versions keep it up to date.
  • It powers games, systems, browsers and competitive programming.
  • This course starts with basics, then OOP and the STL.

C++ क्या है?

C++ एक general-purpose programming language है जो C से निकली। यह C की गति और low-level नियंत्रण रखती है, और बड़े programs व्यवस्थित करने के शक्तिशाली उपकरण जोड़ती है — सबसे प्रसिद्ध रूप से classes और objects के साथ object-oriented programming। संक्षेप में, C++ आपको ऐसा code लिखने देती है जो तेज़ भी हो और सुव्यवस्थित भी।

चूँकि यह hardware के करीब है फिर भी उच्च-स्तरीय विचार समर्थन करती है, C++ वहाँ पसंदीदा है जहाँ performance और नियंत्रण दोनों मायने रखते हैं।

संक्षिप्त इतिहास

C++ को Bjarne Stroustrup ने Bell Labs में बनाया। उन्होंने इसे 1979 में "C with Classes" के रूप में शुरू किया और 1983 में language का नाम C++ रखा गया — ++ C का अपना "एक जोड़ो" operator है, इशारा करते हुए कि C++ "C, एक बढ़ा हुआ" है। इसे बार-बार standardise किया गया है, और C++11, C++17 तथा C++20 जैसे आधुनिक versions उपयोगी features जोड़ते रहते हैं।

C++ क्यों सीखें?

  • यह procedural और object-oriented दोनों programming सिखाती है, तो यह code के बारे में आपकी सोच को व्यापक बनाती है।
  • यह बेहद तेज़ है, इसीलिए games, browsers और systems software में इस्तेमाल होती है।
  • यह अपनी गति और Standard Template Library के कारण competitive programming में शीर्ष पसंद है।
  • C++ समझना कई अन्य languages को आसान बनाता है, क्योंकि इतनी सारी इसके विचार उधार लेती हैं।

मुख्य विशेषताएँ

विशेषतायह आपको क्या देती है
Object-oriented programmingअसली चीज़ें मॉडल करने को classes और objects
गति और नियंत्रणC जैसा hardware-के-करीब performance
Standard Template Libraryतैयार containers और algorithms
Function overloading और templatesलचीला, पुनः-प्रयोग योग्य code लिखना
समृद्ध standard libraryI/O, strings, math और अधिक के उपकरण

C++ code की पहली झलक

यह एक छोटा पूरा C++ program है। अभी हर विवरण की चिंता न करें — आगे के lessons हर हिस्सा समझाते हैं।

main.cpp
#include <iostream>
using namespace std;

int main() {
    cout << "Welcome to C++!" << endl;
    return 0;
}
Output:
Welcome to C++!
  • #include <iostream> input/output features लाता है।
  • main() वह जगह है जहाँ program शुरू होता है।
  • cout screen पर text print करता है; endl line समाप्त करता है।

Compiler set up करने के बाद आप इसे खुद पहला C++ program lesson में लिखेंगे और चलाएँगे।

C++ कहाँ इस्तेमाल होता है

  • Games और game engines (जैसे Unreal Engine)
  • Operating systems और device drivers
  • Browsers और databases
  • Competitive programming और high-performance computing
  • Embedded systems और financial trading platforms

यह course कैसे व्यवस्थित है

हम basics से शुरू करते हैं — compiler set up करना, पहला program लिखना, variables, input/output, loops और functions। फिर हम उस ओर बढ़ते हैं जो C++ को विशेष बनाता है: object-oriented programming (classes, inheritance, polymorphism) और Standard Template Library। हर lesson में code है जिसे आप चला और अभ्यास कर सकते हैं।

सारांश

  • C++ एक तेज़, general-purpose language है जो C के विस्तार के रूप में बनी।
  • यह C की गति में object-oriented programming, templates और STL जोड़ती है।
  • Bjarne Stroustrup ने इसे बनाया; आधुनिक versions इसे अद्यतन रखते हैं।
  • यह games, systems, browsers और competitive programming चलाती है।
  • यह course basics से शुरू होकर फिर OOP और STL पर जाता है।

अक्सर पूछे जाने वाले प्रश्न (FAQ)

C++ क्या है?
C++ एक general-purpose programming language है जो C के विस्तार के रूप में बनी, अन्य features के साथ object-oriented programming का समर्थन जोड़ते हुए। यह तेज़ है, hardware और memory पर सीधा नियंत्रण देती है, और ऐसे software के लिए इस्तेमाल होती है जहाँ performance मायने रखता है, जैसे games, operating systems और high-frequency systems।
C और C++ में क्या अंतर है?
C++ में लगभग पूरी C शामिल है और उसके ऊपर बड़े features जोड़ती है, विशेष रूप से object-oriented programming के लिए classes और objects, साथ ही references, function overloading, templates और Standard Template Library। C केवल procedural है, जबकि C++ procedural और object-oriented दोनों शैलियाँ समर्थन करती है।
क्या C++ beginners के लिए सीखना कठिन है?
C++ कई पहली languages से बड़ी है क्योंकि यह कई programming शैलियाँ देती है, पर आप एक छोटे, सरल हिस्से से शुरू कर सकते हैं — input, output, variables, loops और functions — और वहाँ से बढ़ सकते हैं। पहले basics सीखना और object-oriented features बाद में जोड़ना इसे बहुत सुलभ बनाता है।
C++ आज भी क्यों इस्तेमाल होती है?
C++ लोकप्रिय बनी हुई है क्योंकि यह उच्च performance को शक्तिशाली abstractions के साथ जोड़ती है, programmers को ऐसा तेज़ code लिखने देते हुए जो फिर भी व्यवस्थित और पुनः-प्रयोग योग्य हो। यह games, browsers, databases, operating systems और trading systems चलाती है, और competitive programming में पसंदीदा है।
C++ किसने और कब बनाई?
C++ को Bjarne Stroustrup ने Bell Labs में बनाया, 1979 में "C with Classes" के रूप में शुरू करके और 1983 में इसका नाम C++ रखा। तब से इसे कई बार standardise किया गया है, आधुनिक versions जैसे C++11, C++17 और C++20 बड़े नए features जोड़ते हुए।
← Back to C++ Tutorial
🔗

Share this topic with a friend

यह topic किसी दोस्त को भेजें

Found it useful? Send it to a classmate learning the same thing.

अच्छा लगा? जो दोस्त यही सीख रहा है, उसे भेज दीजिए।

💻 लाइव कोड एडिटर

इस पेज के प्रोग्राम यहीं तैयार हैं — चलाएँ, बदलें और सीखें। कुछ भी इंस्टॉल किए बिना।
OneCompiler द्वारा संचालित। कोड एडिटर में अपने आप आ जाता है — Run दबाकर आउटपुट देखें। अगर एडिटर न खुले तो नए टैब में खोलें.