C++ ni lugha ya programu. Iliundwa na Bjarne Stroustrup na ilianzishwa tarehe 1 Oktoba 1985. Iliundwa ili kuumba mifumo ya uendeshaji, vivinjari au michezo ya video. Leo tunatumia C++17. Ilivutwa na C.

C++
ISO C++ Logo
Shina la studio namna : inaozingatiwa kuhusu kipengee

namna nyingi

namna ya utaratibu

Imeanzishwa Oktoba 1 1985 (1985-10-01) (umri 39)
Mwanzilishi Bjarne Stroustrup
Ilivyo sasa Ilivutwa na: Ada, ALGOL 68, C, CLU, ML, Simula

Ilivuta: Ada 95, C#, C99, Chapel, Clojure, D, Java, Lua, Nim, Perl, PHP, Python, Rust, Seed7

Mahala ISO/IEC JTC1 (Joint Technical Committee 1) / SC22 (Subcommittee 22) / WG21 (Working Group 21)
Tovuti https://www.isocpp.org

Historia

hariri

Ilianzishwa mwaka wa 1985 nchini Marekani. Lakini Bjarne Stroustrup alianza kufanya kazi kuhusu C++ mwaka wa 1980.

Falsafa

hariri

Namna ya C++ ni ile inaozingatiwa kuhusu kipengee, namna nyingi na ya utaratibu.

Sintaksia

hariri

Sintaksia ya C++ ni ngumu sana; inafananishwa na lugha za programu nyingine kama JavaScript, Python au Ruby. Ilivutwa na sintaksia ya C, lugha ya programu nyingine.

Mifano ya C++

hariri

Programu kwa kuchapa « Jambo ulimwengu !».

#include <iostream>

int main()
{
    using std::cout;

    cout << "Jambo ulimwengu !" << std::endl;
}

void foo()
{
    std::cout << "Jambo ulimwengu !" << std::endl;
}

Programu kwa kutafuta maneno katika nakala.

#include<string>

template<typename T>
T max(T a, T b)
{
    return a < b? b: a;
}

int main()
{
    int i = max(3, 5);
    char c = max('e', 'b');
    std::string s = max(std::string("jambo"), std::string("dunia"));
    float f = max<float>(1, 2.2f);
}

Marejeo

hariri
  • [Deitel et Deitel 2011] (en) P. Deitel et H. Deitel, C++ : How to Program, 20 Hall, 2011, 8e éd., 1104 p. (ISBN 978-0-13-266236-9).
  • [Dawson 2010] (en) M. Dawson, Beginning C++ Through Game Programming, Course Technology PTR, 2010, 3e éd., 432 p. (ISBN 978-1-4354-5742-3).
  • [Gregoire, Solter et Kleper 2011] (en) Marc Gregoire, Nicolas A. Solter et Scott J. Kleper, Professional C++, John Wiley, octobre 2011, 1104 p. (ISBN 978-0-470-93244-5, présentation en ligne [archive]).
  • [Josuttis 2011] (en) Nicolaï Josuttis, The C++ Standard Library, A Tutorial and Reference, Addison-Wesley, 2011, 2e éd., 1099 p. (ISBN 978-0-321-62321-8, présentation en ligne [archive]).
  • [Koenig et Moo 2000] (en) A. Koenig et B. Moo, Accelerated C++ : Practical Programming by Example, Addison-Wesley, 2000, 1re éd., 352 p. (ISBN 978-0-201-70353-5).
  • [Lippman, Lajoie et Moo 2012] (en) Stanley B. Lippman, Josée Lajoie et Barbara E. Moo, C++ Primer : 5th Edition, août 2012, 5e éd., 1399 p. (ISBN 978-0-321-71411-4).