C++

(Redirected from C++ (programming language))

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.

C++
Paradigm(s)Multi-paradigm:[1] procedural, functional, object-oriented, generic
Appeared in1983
Designed byBjarne Stroustrup
DeveloperBjarne Stroustrup
Bell Labs
ISO/IEC JTC1/SC22/WG21
Stable releaseISO/IEC 14882:2017 / 1 December 2017; 5 years ago (2017-12-01)
Typing disciplineStatic, unsafe, nominative
Major implementationsC++ Builder, clang, Comeau C/C++, GCC, Intel C++ Compiler, Microsoft Visual C++, Sun Studio
DialectsISO/IEC C++ 1998, ISO/IEC C++ 2003, ISO/IEC C++ 2011, ISO/IEC C++ 2014, ISO/IEC C++ 2017,
Influenced byC, Simula, Ada 83, ALGOL 68, CLU, ML[1]
InfluencedPerl, LPC, Lua, Pike, Ada 95, Java, PHP, D, C99, C#, Falcon
OSCross-platform (multi-platform)
Usual filename extensions.h .hh .hpp .hxx .h++ .cc .cpp .cxx .c++
Wikibooks logo C++ Programming at Wikibooks
Bjarne Stroustrup, the creator of C++

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.

C++ runs on a variety of platforms, such as Windows, Mac OS, and the various versions of UNIX. C++ is simple and practical approach to describe the concepts of C++ for beginners to advanced software engineers.

C++ is a general-purpose programing language which means that it can be used to create different variety of applications.C++ is used for variety of application domains.

Example

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. <syntaxhighlight lang="cpp"> // This is a comment. It's for *people* to read, not computers. It's usually used to describe the program.

// Make the I/O standard library available for use in the program.

  1. include <iostream>

using namespace std; // We are now defining the main function; it is the function run when the program starts. int main() {

   // Printing a message to the screen using the standard output stream std::cout.
   cout << "Hello World!";

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

<syntaxhighlight lang="cpp">

  1. include <iostream>

int main() {

   // Print a simple calculation.
   std::cout << 3 + 2;

} </syntaxhighlight>

This program subtracts, multiplies, divides and then prints the answer on the screen. <syntaxhighlight lang="cpp">

  1. include <iostream>

int main() {

   // Create and initialize 3 variables, a, b, and c, to 5, 10, and 20.
   int a = 5;
   int b = 10;
   int c = 20;
   // Print calculations.
   std::cout << a-b-c;
   std::cout << a*b*c;
   std::cout << a/b/c;

} </syntaxhighlight>

References

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