Questions Columns Rows
GitHub icon

C++

C++ - Programming language

< >

C++ is a programming language created in 1985 by Bjarne Stroustrup.

#7on PLDB 38Years Old 2mRepos

Try now: RijuReplit

C++ ( pronounced cee plus plus) is a general-purpose programming language. It has imperative, object-oriented and generic programming features, while also providing facilities for low-level memory manipulation. It was designed with a bias toward system programming and embedded, resource-constrained and large systems, with performance, efficiency and flexibility of use as its design highlights. Read more on Wikipedia...


Example from Compiler Explorer:
// Type your code here, or load an example. int square(int num) { return num * num; }
Example from Riju:
#include <iostream> int main() { std::cout << "Hello, world!" << std::endl; return 0; }
Example from hello-world:
#include <iostream> int main() { std::cout << "Hello World" << std::endl; }
// Hello World in C++ (pre-ISO) #include <iostream.h> main() { cout << "Hello World!" << endl; return 0; }
Example from Linguist:
#include <cstdint> namespace Gui { }
Example from Wikipedia:
1 #include <iostream> 2 #include <vector> 3 #include <stdexcept> 4 5 int main() { 6 try { 7 std::vector<int> vec{3, 4, 3, 1}; 8 int i{vec.at(4)}; // Throws an exception, std::out_of_range (indexing for vec is from 0-3 not 1-4) 9 } 10 // An exception handler, catches std::out_of_range, which is thrown by vec.at(4) 11 catch (std::out_of_range &e) { 12 std::cerr << "Accessing a non-existent element: " << e.what() << '\n'; 13 } 14 // To catch any other standard library exceptions (they derive from std::exception) 15 catch (std::exception &e) { 16 std::cerr << "Exception thrown: " << e.what() << '\n'; 17 } 18 // Catch any unrecognised exceptions (i.e. those which don't derive from std::exception) 19 catch (...) { 20 std::cerr << "Some fatal error\n"; 21 } 22 }
#define #defined #elif #else #endif #error #if #ifdef #ifndef #include #line #pragma #undef alignas alignof and and_eq asm atomic_cancel atomic_commit atomic_noexcept auto bitand bitor bool break case catch char char16_t char32_t class compl concept const constexpr const_cast continue decltype default delete do double dynamic_cast else enum explicit export extern false final float for friend goto if inline int import long module mutable namespace new noexcept not not_eq nullptr operator or or_eq override private protected public register reinterpret_cast requires return short signed sizeof static static_assert static_cast struct switch synchronized template this thread_local throw transaction_safe transaction_safe_dynamic true try typedef typeid typename union unsigned using virtual void volatile wchar_t while xor xor_eq

View source

- Build the next great programming language Search Add Language Features Creators Resources About Blog Acknowledgements Stats Sponsor Traffic Traffic Today Day 267 feedback@pldb.com Logout