From SwinBrain

(Redirected from C Plus Plus)

C++ is a general purpose object oriented language. With a few minor exceptions C++ is a superset of C. The Common Features of C Based Languages article provides a suitable overview of the core features that C++ inherited from the C language.


Hello World in C++

  1. #include<iostream>
  3. int main()
  4. {
  5. std::cout << "Hello World" << std::endl;
  6. return 0;
  7. }

C++ Keywords

Note that all the keywords are in lowercase, and C++ is case sensitive. Not all compilers implement all keywords (yet), and some compilers introduce their own new keywords.

C++ Keywords
asm double int sizeof union
audo dynamic_cast long static unsigned
bool else mutable static_cast using
break enum namespace struct virtual
case explicit new switch void
catch export operator template volatile
char extern private this wchar_t
class false public throw while
const float register true inline
const_cast for reinterpret_case try protected
continue friend return typedef  
default goto short typeid  
delete if signed typename  

Basic Data Types

Type NameType of data it contains
booltrue or false
charsingle character
wchar_tsingle wide-character (unicode)
shortsmall intergers, equivalent to short int
intinteger numbers
longlong integer numbers, equivalent to long int
floatsingle-precision floating-point numbers
doubledouble-precision floating-point numbers
long doublevery large floating-point numbers
voidno data type

The char, short, int and long types can all be qualified with signed or unsigned.

The actual range of values for each type contains depends on the platform and compiler used. Usually int and float are 32-bit values, and double is 64 bits, and char is almost always 8-bits.

More C++ Pages on this wiki

Pointer arithmetic

Free Compilers

On windows there are a number of good free compilers.

  • Microsoft Visual Studio Express Edition contains a free version of the Microsoft C++ compiler and Integrated Developing Environment suitable for non-commercial work
  • MinGW contains a build of g++, the GNU C++ compiler, which is specifically designed for doing native windows development.
  • Cygwin contains an alternative port of the g++.

Further Information

[edit]Language: C | Objective C | C++ | C# | Java | Pascal | Perl | PHP | Python | Visual Basic | more to come

Sample Code » C | C++ | .NET | Pascal | Perl | T-Sql | XHTML | Python | others to come