From Wikipedia, the free encyclopedia
(Redirected from C++ (programming language))
Jump to navigation Jump to search
ParadigmMulti-paradigm:[1] procedural, functional, object-oriented, generic
Designed byBjarne Stroustrup
DeveloperBjarne Stroustrup
Bell Labs
First appeared1983
Stable releaseISO/IEC 14882:2017 / 1 December 2017; 17 months ago (2017-12-01)
Typing disciplineStatic, unsafe, nominative
OSCross-platform (multi-platform)
Filename extensions.h .hh .hpp .hxx .h++ .cc .cpp .cxx .c++
Major implementations
C++ Builder, clang, Comeau C/C++, GCC, Intel C++ Compiler, Microsoft Visual C++, Sun Studio
ISO/IEC C++ 1998, ISO/IEC C++ 2003, ISO/IEC C++ 2011, ISO/IEC C++ 2014, ISO/IEC C++ 2017,
Influenced by
C, Simula, Ada 83, ALGOL 68, CLU, ML[1]
Perl, LPC, Lua, Pike, Ada 95, Java, PHP, D, C99, C#, Falcon
Bjarne Stroustrup, the creator of C++

C++ (pronounced "see plus plus") is a computer programming language based on C. It was created for writing programs for many different purposes. In the 1990s, C++ became one of the most used programming languages in the world.

The C++ programming language was developed by Bjarne Stroustrup at Bell Labs in the 1980s, and was originally named "C with classes". The language was planned as an improvement on the C programming language, adding features based on object-oriented programming. Step by step, a lot of advanced features were added to the language, like operator overloading, exception handling and templates.

Example[change | change source]

The following text is C++ source code and it will write the words "Hello World!" on the screen when it has been compiled and is executed. This program is typically the first program a programmer would write while learning about programming languages.

// This is a comment. It's for *people* to read, not computers. It's usually used to describe the program.

// Iostream is the input and output stream; which stores functions such as print etc.
#include <iostream>
// Namespace std; is the standard namespace which also stores some functions
using namespace std;

// We are now creating an important instance; the main function
int main()
    // Printing a message to cout (Character Output Stream)
    cout << "Hello World!";
    // Tells the computer that the code was executed successfully; by sending a zero
    return 0;

This program is similar to the last, except it will add 3 + 2 and print the answer instead of "Hello World!".

#include <iostream>
using namespace std;

int main()
    // Printing a simple calculation
    cout << 3 + 2;
    return 0;

This program subtracts, multiplies, divides and then prints the answer on the screen.

#include <iostream>
using namespace std;

int main()
    // Creating and initializing 3 variables, a, b, and c, to 5, 10, and 20.
    int a = 5;
    int b = 10;
    int c = 20;

    // Printing calculations
    cout << a-b-c;
    cout << a*b*c;
    cout << a/b/c;
    return 0;

References[change | change source]

  1. 1.0 1.1 Stroustrup, Bjarne (1997). "1". The C++ Programming Language (Third ed.). ISBN 0201889544. OCLC 59193992. |access-date= requires |url= (help)