Getting Started Lesson 1 of 17
Introduction to C++
What C++ is, how it grew from C, where it's used, what makes it powerful, and the parts of a first C++ program with cout.
C++ was created by Bjarne Stroustrup, starting in 1979, as "C with Classes". It keeps C's speed and control over memory, and adds tools for organizing large programs. Today it's one of the most important languages for performance-critical software.
Your first C++ program
#include <iostream>
using namespace std;
int main() {
cout << "Mabuhay, Pilipinas!" << endl;
return 0;
}
Output
Mabuhay, Pilipinas!
#include <iostream>brings in input/output streams (coutandcin).using namespace std;lets you writecoutinstead ofstd::cout. Everything in the standard library lives in thestdnamespace.int main()is where the program starts.cout << ...sends text to the screen.<<is called the insertion operator.endlends the line (you can also use"\n").
Where is C++ used?
| Area | Examples |
|---|---|
| Games | Unreal Engine, many console and PC games |
| Big applications | Chrome, Photoshop, Microsoft Office |
| Embedded and robotics | Arduino, drones, cars, factory machines |
| Finance and science | Trading systems, simulations |
| Competitive programming | The most popular language in coding contests like ICPC and NOI.PH |
What C++ adds to C
- Classes and objects for object-oriented programming.
std::string: text that grows automatically, no'\0'worries.std::vector: arrays that resize themselves.- References: a simpler alternative to many pointer uses.
- The STL (Standard Template Library): ready-made containers and algorithms like
sort. - Exceptions for error handling.
Compiled and fast
Like C, C++ is compiled directly to machine code, so programs run very fast. The compiler checks types carefully, catching many mistakes before the program runs.
C++ versus other languages
| C++ | Java | Python | |
|---|---|---|---|
| Speed | Very fast | Fast | Slower |
| Memory | You control it | Garbage collected | Garbage collected |
| Learning curve | Steeper | Medium | Gentle |
cout << "Hi"; | System.out.println("Hi"); | print("Hi") |
About using namespace std
This course uses using namespace std; to keep examples short, as most textbooks and schools do. In large professional projects, many programmers write std::cout and std::string instead, to avoid name clashes. Both are correct; just know that cout and std::cout are the same thing.
Quick Quiz
Check what you learned. Walang grade ito, practice lang. 🙂
By Sir Reyel · Last updated 2026-12-04