GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • C++ Tutorial
  • Interview Questions
  • Examples
  • Quizzes
  • Projects
  • Cheatsheet
  • OOP
  • Exception Handling
  • STL
  • DSA C++
  • Introduction2 min read
  • Data Types4 min read
  • Variables4 min read
  • Operators9 min read

This view

  • Original page
  • New address

GeezerVison is showing www.geeksforgeeks.org — Introduction to C++ - GeeksforGeeks

geeksforgeeks
search icon
  • Courses
  • Tutorials
  • Interview Prep
  • C++ Tutorial
  • Interview Questions
  • Examples
  • Quizzes
  • Projects
  • Cheatsheet
  • OOP
  • Exception Handling
  • STL
  • DSA C++

Introduction to C++

Last Updated : 30 Oct, 2026

C++ is a general-purpose programming language developed by Bjarne Stroustrup as an extension of C. It is widely used for developing high-performance applications, system software, games, and embedded systems.

  • Supports both procedural and object-oriented programming paradigms.
  • Provides fast execution speed and direct memory management capabilities.
  • Widely used in operating systems, game engines, embedded systems, and competitive programming.

Features of C++

Features_of_CPP
Features-of-C++

C++ offers several features for developing efficient, flexible, and high-performance applications.

  • Object-Oriented Programming: Supports classes and objects to organize code and promote reusability.
  • High Performance Execution: Provides fast execution through efficient compilation into native machine code.
  • Low-Level Memory Control: Allows direct memory management using pointers and dynamic memory allocation.
  • Rich STL Libraries: Provides the Standard Template Library (STL) with containers, algorithms, and iterators.
  • General Purpose Language: Used to develop operating systems, games, embedded systems, and desktop applications.

First C++ Program

The below C++ code shows the basic structure of a program.

C++
#include <iostream>
using namespace std;

int main() {
    cout << "Hello, World!";
    return 0;
}

Output
Hello, World!

Structure of the C++ program

The basic structure of a C++ program defines the standard way every program must be written; otherwise, it will cause a compilation error. The structure includes:

prim_s_algorithm_14

A basic C++ program consists of several components that define its structure, handle input/output operations, and control program execution.

  • Header File: #include <iostream> provides standard input/output facilities such as cin and cout.
  • Namespace Declaration: using namespace std; allows standard library names to be used without the std:: prefix.
  • Main Function: int main() is the entry point where program execution begins.
  • Comments: // and /* ... */ are used to add single-line and multi-line comments.
  • Statement: cout << "Hello World!"; displays text on the screen using the insertion operator (<<).
  • Return Statement: return 0; ends the main() function and indicates successful execution.

How to Run the Above Code?

13234-

Follow these steps to compile and run a C++ program and display its output on the screen.

  • Write the code in a file such as HelloWorld.cpp.
  • Use a C++ compiler (G++, Clang, or MSVC) to compile the source code.
  • The compiler converts the source code into an executable file (such as HelloWorld.exe).
  • The operating system loads the executable file into memory.
  • The CPU executes the program instructions starting from the main() function.
  • The program displays the output on the screen.

Related Article: C++ vs Other Languages

Comment

Explore

    C++ Basics
    • Introduction2 min read
    • Data Types4 min read
    • Variables4 min read
    • Operators9 min read
    • Basic Input / Output2 min read
    • Control Flow Statements15+ min read
    • Loops7 min read
    • Functions5 min read
    • Arrays5 min read
    Core Concepts
    • Pointers and References4 min read
    • new and delete Operators5 min read
    • Templates in C++7 min read
    • Struct Union Enum3 min read
    • Exception Handling5 min read
    • File Handling9 min read
    • Multithreading6 min read
    • Namespace5 min read
    OOP
    • OOP Concepts10 min read
    • Inheritance6 min read
    • Polymorphism5 min read
    • Encapsulation3 min read
    • Abstraction4 min read
    Standard Template Library(STL)
    • STL3 min read
    • Container Library3 min read
    • Iterators10 min read
    • Algorithm Library3 min read
    Practice & Problems
    • Interview Questions15+ min read
    • Programming Examples4 min read
    Courses
    • Placement 360 Course2 min read
    • DSA and System Design Course2 min read
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.