Lecturer: Dr Philip Blakely
This course will introduce students to C++ as a language widely used in scientific computing. The course will cover most aspects of C++ to an intermediate level, with the aim being to teach students sufficient C++ to program non-trivial algorithms in a robust and efficient manner. The course should be accessible to all students, irrespective of any prior programming knowledge.
Students should leave the course knowing:
- Fundamentals of C++ programming, from variables, loops, to functions.
- Object Oriented Programming in C++ and polymorphism.
- Performance characteristics of data structures.
Course Structure:
- Basic arithmetic, including types and overflow
- Branching constructs
- Loop constructs
- Functions, pass by reference and value
- Arrays, pointers, and heap allocation
- Use of the pre-processor, include-files, and linking
- Object-oriented programming: classes, inheritance, virtual functions, polymorphism
- Function and operator overloading
- STL containers and algorithms
- Simple uses of templates
Practicals:
- Simple functions in C++
- Loops and arrays
- Transforming a one-file code into a multi-file, multi-stage compilation.
- Creating a class hierarchy with polymorphism.
- Vectors, lists, and maps data structures.
- Templating a sumVectors() function.
Prerequisites: Background in some scientific programming language, such as Matlab, C, Fortran, or Python.
Required course for: All Continuum Mechanics courses
Recommended reading:
- C ++ Primer, Lippman, Lajoie, Moo, Addison Wesley
- Programming: Principles and Practice Using C ++ , Bjarne Stroustrup.
- The C ++ Programming Language 3rd edition, Bjarne Stroustrup, Addison Wesley
Picture credit:
Dr Philip Blakely