Definition
📌 Introduction
C++ was created by Bjarne Stroustrup in 1985 as "C with Classes" — it takes the performance and low-level control of C and adds object-oriented programming (classes, inheritance, polymorphism) plus a large standard library (the STL).C++ is widely used for game engines, competitive programming, high-frequency trading systems, and performance-critical software..
Syntax
syntax
#include <iostream>
using namespace std;
int main() {
// your code here
return 0;
}Example
cpp
#include <iostream>
using namespace std;
int main() {
cout << "Hello, World!" << endl;
return 0;
}Output
outputHello, World!
Important Points
- C++ adds object-oriented features (classes, objects) on top of C.
coutandcincome from theiostreamheader for output and input.using namespace std;lets you writecoutinstead ofstd::cout.- C++ has a huge standard library called the STL (Standard Template Library).
Common Mistakes
- Forgetting to
#include <iostream>before usingcout. - Mixing up
<<(used withcout) and>>(used withcin). - Omitting
using namespace std;and then forgetting thestd::prefix.
Interview Tip
🎯 Before your interview
Interviewers may ask "is C++ backward compatible with C?" — largely yes, though a few edge cases differ (e.g. stricter type checking in C++).
