C++ is a general-purpose, high-performance programming language created by Bjarne Stroustrup in 1979 as an extension of the C language. It was originally called "C with Classes" and was renamed C++ in 1983.
C++ is one of the world's most popular programming languages and is used to develop:
Operating systems (Windows, Linux kernel)
Game engines (Unreal Engine)
Web browsers (Chrome, Firefox)
Databases (MySQL, MongoDB)
Embedded systems and IoT devices
High-frequency trading software
Why Learn C++?
Speed: C++ programs run very fast — close to machine code performance.
Control: You have direct control over memory and hardware.
Versatility: Supports procedural, object-oriented, and generic programming.
Foundation: Learning C++ makes it easier to learn Java, C#, and other languages.
Jobs: C++ developers are in high demand with excellent salaries.
Your First C++ Program
Every C++ journey starts with a simple "Hello, World!" program:
#include <iostream>
using namespace std;
int main() {
cout << "Hello, World!" << endl;
return 0;
}
Output:
Hello, World!
Code Explained
#include <iostream> — Includes the input/output stream library so we can use cout.
using namespace std; — Lets us use standard library names without the std:: prefix.
int main() — Every C++ program must have a main() function. Execution starts here.
cout << "Hello, World!" << endl; — Prints text to the screen. endl adds a newline.
return 0; — Signals that the program ended successfully.
Note: C++ is case-sensitive. cout is not the same as Cout or COUT.
Exercise
Modify the Hello World program to print your own name on the screen.
Show Solution
#include <iostream>
using namespace std;
int main() {
cout << "Hello, my name is Alex!" << endl;
return 0;
}
Quiz
Who created C++?
A) Dennis Ritchie
B) Bjarne Stroustrup
C) James Gosling
D) Guido van Rossum
Answer
B) Bjarne Stroustrup — He created C++ in 1979 at Bell Labs.
What does #include <iostream> do?
A) Defines the main function
B) Imports the math library
C) Includes the input/output stream library
D) Creates a namespace
Answer
C) It includes the iostream library which provides cout and cin.
Which function is the entry point of every C++ program?
A) start()
B) run()
C) begin()
D) main()
Answer
D) main() — Every C++ program begins execution from the main() function.
FAQ
Is C++ hard to learn?
C++ has a steeper learning curve than Python or JavaScript, but with structured practice it is very learnable. Start with the basics and build up gradually.
C++ vs C — what is the difference?
C++ includes everything C has, plus object-oriented programming (classes, objects, inheritance, polymorphism) and the Standard Template Library (STL).