C++ was initially designed as an extension of C and adds object oriented and meta programming features. Like C it is a statically typed imperative language, but in addition it provides many high level features such as exceptions and libraries.
C++ is generally compiled and compilers exist for many platforms, however due to the complexity of the C++ standard, compilers don't always behave the same way.
Here is an example of the 100 doors problem:
#include <iostream>
#include <vector>
void doors (int n)
{
// Initialize a vector of n boolean values
std::vector<bool> is_open(n);
// Process the doors
for (int pass = 0; pass < n; ++pass)
for (int door = pass; door < n; door += pass+1)
is_open[door].flip();
// Print out the results
for (int door = 0; door < n; ++door)
std::cout << "Door #" << door+1 << (is_open[door] ? " is open." : " is closed.") << std::endl;
}
int main(int argc, char ** argv)
{
// Call the doors function with n = 100
doors(100);
return 0;
}
C++ is in some ways a super-set of C. It was originally called "C with Objects". It adds many advanced language features such as classes, namespaces, exceptions and meta-programming.
C++ has many of the same issues as C, but it also adds many new issues (complex syntax and semantic behavior). On the whole, however, it is a useful language which is used in many different industries.
C++ provides a useful level of abstraction and performance, and is used in both application development. The majority of computer games are written using C++.