| | 1 | = C++ codes = |
| | 2 | == Hello World == |
| | 3 | {{{#!C |
| | 4 | //hello.cpp: display a message on the screen |
| | 5 | #include <iostream> |
| | 6 | |
| | 7 | int main() |
| | 8 | { |
| | 9 | std::cout << "Hello, C++ world!\n"; |
| | 10 | return 0; |
| | 11 | } |
| | 12 | }}} |
| | 13 | * Text after // are comments. |
| | 14 | * can use C style comments. |
| | 15 | * can use C functions. |
| | 16 | * '''#include <iostream>''' to load the header file. |
| | 17 | * There are many header files in the standard C++ library.[1] |
| | 18 | * Program always begins with '''main()''' function. |
| | 19 | * '''main()''' returns a integer. |
| | 20 | |
| | 21 | == Compile with GNU C++ == |
| | 22 | {{{g++ hello.cpp}}} |
| | 23 | |
| | 24 | == Compile with Intel C++ == |
| | 25 | {{{ icpc hello.cpp }}} |
| | 26 | |
| | 27 | == Links for tutorial == |
| | 28 | * [[http://www.cplusplus.com/doc/tutorial/|C++ Language Tutorial]] |
| | 29 | * [[http://en.wikibooks.org/wiki/C++_Programming|wikibooks]] |
| | 30 | |
| | 31 | == Examples of Job Script == |
| | 32 | See Examples |
| | 33 | |
| | 34 | == Parallel C++ == |
| | 35 | * OpenMP examples in C++ |
| | 36 | * MPI examples in C++ |
| | 37 | |
| | 38 | == Useful Libraries for Scientific Computing == |
| | 39 | [[http://www.dealii.org/|deal.II]] - A Finite Element Differential Equations Analysis Library, [[http://www.dealii.org/7.1.0/doxygen/tutorial/index.html|tutorial]] |