Introduction to scientific C/C++

chapter 1 chapter 2 chapter 3

next

 

 

Overview

This document is thought to be a programming course for physicists using C and C++. It is neither aiming on giving a complete overview of one of those languages nor is it separating C and C++ very well. Instead we will make use of both elements throughout this course. In the end you should be able to program and compile C/C++ "simple" programs for e.g. data analysis or  simple calculations as well as understand and modify projects making use of complex packets like GEANT4 or ROOT from CERN, which extensively use object oriented programming (OOP).

Special emphasize will be paid on the scientific use, one example is the detailed discussion of floating point data types in Chapter 3. Also the example programs (including the home exercises) will usually deal with physical problems.

Exercises will be provided and you may send your solutions to me before the start of the next chapter. Then you will also find my solutions to the problems given.

All examples are tested on a Linux environment using GNU's g++ (part of gcc: Gnu Compiler Collection) Version 2.8. The use of older or more recent versions shouldn't be any problem. I recommend creating an own directory for this course, maybe with subdirectories for the single chapters.

My preferred and therefore my recommendation as an editor is nedit as it is simple to use but comes with a wide variety of functions like syntax highlighting (go to the options menu to activate permanently, also activate the statistics line and deactivate wrap). Another popularly used editor which you might want to use is (X)emacs.

email me: Daniel Schürmann