Changes

5,393 bytes removed ,  12:22, 4 September 2023
m
KS update 1.3
Line 1: Line 1: −
{{Infobox programming language
+
:''If you typed '''C#''' and arrived at this page, then see [[C-sharp]].''
| name                  = C++
  −
| logo                  = File:ISO C++ Logo.svg
  −
| paradigm              = [[Multi-paradigm programming language|Multi-paradigm]]:<ref name="stroustruptcpppl" /> [[procedural programming|procedural]], [[functional programming|functional]],  [[object-oriented programming|object-oriented]], [[generic programming|generic]]
  −
| year                  = 1983
  −
| designer              = [[Bjarne Stroustrup]]
  −
| developer              = Bjarne Stroustrup<br>[[Bell Labs]]<br>{{nobr|ISO/IEC JTC1/SC22/WG21}}
  −
| latest_release_version = ISO/IEC 14882:2020
  −
| latest_release_date    = {{Start date and age|2020|12|15|df=yes}}
  −
| latest_test_version    =
  −
| latest_test_date      =
  −
| typing                = [[Static type|Static]], [[Type system#Safely and unsafely typed systems|unsafe]], [[Nominative type system|nominative]]
  −
| implementations        = {{nowraplinks}}[[C++ Builder]], [[clang]], [[Comeau C/C++]], [[GNU Compiler Collection|GCC]], [[Intel C++ Compiler]], [[Microsoft Visual C++]], [[Sun Studio (software)|Sun Studio]]{{nowraplinks end}}
  −
| dialects              = {{nowraplinks}}[[ISO/IEC 14882|ISO/IEC C++]] 1998, [[ISO/IEC 14882|ISO/IEC C++]] 2003, [[ISO/IEC 14882|ISO/IEC C++]] 2011, [[ISO/IEC 14882|ISO/IEC C++]] 2014, [[ISO/IEC 14882|ISO/IEC C++]] 2017, [[ISO/IEC 14882|ISO/IEC C++]] 2020{{nowraplinks end}}
  −
| influenced_by          = [[C (programming language)|C]], [[Simula]], [[Ada (programming language)|Ada 83]], [[ALGOL 68]], [[CLU (programming language)|CLU]], [[ML (programming language)|ML]]<ref name="stroustruptcpppl">{{Cite book | last=Stroustrup | first=Bjarne | title=The C++ Programming Language | year=1997 | edition=Third | <!-- chapter=1 | --> isbn=0201889544 | oclc=59193992 }}</ref>
  −
| influenced            = [[Perl]]<!--1987-->, [[LPC (programming language)|LPC]]<!--1989-->, [[Lua]]<!--1993-->, [[Pike (programming language)|Pike]]<!-- 1994 -->, [[Ada (programming language)|Ada 95]]<!--1995-->, [[Java (programming language)|Java]]<!--1995-->, [[PHP]]<!--1995-->, [[D (programming language)|D]]<!--1999-->, [[C99]]<!--1999-->, [[C Sharp (programming language)|C#]]<!--2001-->, [[Falcon (programming language)|Falcon]]<!--2003-->
  −
| operating_system      = [[Cross-platform|Cross-platform (multi-platform)]]
  −
| license                =
  −
| website                =
  −
| file_ext              = .h .hh .hpp .hxx {{nowrap|.h++}} .cc .cpp .cxx {{nowrap|.c++}}
  −
| wikibooks              = C++ Programming
  −
|logo caption=C++ logo used by ISO}}
  −
[[File:BjarneStroustrup.jpg|right|thumb|Bjarne Stroustrup, the creator of C++]]
  −
'''C++''' (pronounced "see plus plus") is a [[computer]] [[programming language]] based on [[C programming language|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. Like C, C++ uses manual memory management (unlike most mainstream languages, where memory management is automatic), while the syntax usually used for it is different.
     −
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)|C]] programming language, adding features based on [[object-oriented programming]]. Step by step, a lot of advanced features were added to the language, like [[exception handling]], [[templates (programming)|templates]], "move semantics" and [[namespace]]s (not full module support, while that was added later) and new [[operator overloading]] capabilities were added in versions C++11 and C++20.
+
== C Media ==
 +
<gallery widths='160px' heights='100%' mode='traditional' caption=''>
 +
File:Camelus bactrianus-sil.svg|Black and white silhouette of Camelus bactrianus
   −
C++ runs on a most platforms (all mainstream ones), such as [[Windows]], [[macOS]], and the various versions of UNIX, for example [[Linux]]. [https://web.archive.org/web/20200713161758/https://www.programstudio.online/2020/05/introduction-to-c.html Introduction to C++ language] is a practical approach to describe the concepts of C++ for beginners to advanced software engineers.
+
File:Proto-semiticG-01.svg|# Proto-semitic Gimel, a theological invention.
   −
C++ is a general-purpose programing language which means that it can be used to create different variety of applications. [https://codinggrammar.com/what-is-cpp-used-for/ C++ is used for] variety of application domains.
+
File:Phoenician gimel.svg|Phoenician letter gimel
   −
C++20 is the latest version of the standard, which finally added for example module support in December 2020 (while many languages supported modules a decade, if not two or more, earlier). The major compilers have almost complete support for C++20, while almost all default to the older C++17 standard, so a compiler switch is needed to enable the C++20 support the compilers have.
+
File:Greek Gamma 03.svg|Glyph shape found in ancient Greek epigraphy (Gamma).
   −
New C++ standards are on a three-year schedule, so the next one, C++23, is expected in 2023, and some compilers already have some (partial) support for that experimental standard. The many earlier C++ standards have each added stuff to the language, almost never taken stuff out, so mostly keeping compatibility with older standards.
+
File:Early Etruscan C.svg|Early Etruscan c
   −
== Example ==
+
File:Phoenician gimel.svg|Phoenician letter gimel
The following text is C++ source code and it will write the words "[[Hello world program|Hello World!]]" on the screen when it has been [[compiled language|compiled]] and is executed. This program is typically the first program a programmer would write while learning about programming languages.
     −
<syntaxhighlight lang="cpp">
+
File:Gamma uc lc.svg|Uppercase and lowercase Greek letter gamma, the 3rd letter of the Greek alphabet. Times New Roman font.
// 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.
+
File:EtruscanC-01.svg|Etruscan H
#include <iostream>
     −
// We are now defining the main function; it is the function run when the program starts.
+
File:Old Latin G.svg|Old Latin letter G/C, created with Inkscape by using the PNG-Version as template.
int main()
+
</gallery>
{
+
{{A-Z}}
    // Printing a message to the screen using the standard output stream std::cout.
+
[[File:C cursiva.gif|thumb]]
    std::cout << "Hello World!";
+
'''C''' is the third ([[three|3rd]]) [[letter]] in the [[English language|English]] [[alphabet]] and [[ISO basic latin alphabet]].
    return 0;
+
== Meanings for C ==
}
+
* In [[temperature]], ''°C'' means "degrees [[Celsius]]".
</syntaxhighlight>
+
* In [[music]], ''C'' is a [[Note (music)|note]] sometimes referred to as “Do”.
 +
* In [[chemistry]], ''C'' is the atom of [[carbon]], as in '''C'''<sub>40</sub>[[H]]<sub>56</sub>.
 +
* In [[physics]], ''c'' is the [[speed of light]], as in E=mc².
 +
* In [[Roman numeral]]s, ''C'' means "one [[hundred]]" (100).
 +
* There is a [[programming language]] called ''C'', see [[C programming language]].
 +
* In [[electronics]], C is a type of [[battery]].
 +
*C can also mean the [[copyright]] symbol
 +
== Pronunciation ==
 +
*The letter "C" is  pronounced as /k/.We can also say the letter "C" as /s/.
 +
*The letter "C"'s name in English is "ce" (said as  /ˈsiː/).
   −
This program is similar to the last, except it will add 3 + 2 and print the answer instead of "Hello World!".
+
{{wikt}}
 +
{{Latin script}}
 +
{{commonscat}}
   −
<syntaxhighlight lang="cpp">
  −
#include <iostream>
     −
int main()
+
{{stub}}
{
  −
    // Print a simple calculation.
  −
    std::cout << 3 + 2;
  −
    return 0;
  −
}
  −
</syntaxhighlight>
  −
 
  −
This program subtracts, multiplies, divides and then prints the answer on the screen.
  −
 
  −
<syntaxhighlight lang="cpp">
  −
#include <iostream>
  −
 
  −
int main()
  −
{
  −
    // Create and initialize three 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;
  −
    return 0;
  −
}
  −
</syntaxhighlight>
  −
 
  −
== Manual memory management ==
  −
C++ introduced two keywords <code>new</code> and <code>delete</code> for manual memory management (while also keeping compatibility with the old way C uses), and the constructor and destructor concepts. In modern C++ code, using <code>new</code> and <code>delete</code> (and destructors) is no longer preferred in high-level code, rather containers such as <code>std:vector</code> (which at a low level are implemented with <code>new</code> and <code>delete</code>).
  −
 
  −
== References ==
  −
{{reflist}}
  −
 
  −
{{Tech-stub}}
  −
{{authority control}}
  −
[[Category:Multi-paradigm programming languages]]
  −
[[Category:Object-oriented programming languages]]
  −
[[Category:Cross-platform software]]