Informatik für Mathematiker und Physiker - HS 18


Course catalog: 252-0847-00L
Lecturers: Malte Schwerhoff, Felix Friedrich


Primary educational objective is to learn programming with C++. After having successfully attended the course, students have a good command of the mechanisms to construct a program. They know the fundamental control and data structures and understand how an algorithmic problem is mapped to a computer program. They have an idea of what happens "behind the scenes" when a program is translated and executed. Secondary goals are an algorithmic computational thinking, understanding the possibilities and limits of programming and to impart the way of thinking like a computer scientist.

The course covers fundamental data types, expressions and statements, (limits of) computer arithmetic, control statements, functions, arrays, structural types and pointers. The part on object orientation deals with classes, inheritance and polymorphism; simple dynamic data types are introduced as examples. In general, the concepts provided in the course are motivated and illustrated with algorithms and applications.

Date Message
21.12

Single PDFs with all slides are now available: lecture DE, lecture EN, handout DE, handout EN

29.11

The dry-run exam (Moodle) is online, as is the master solution (PDF). Instructions have been emailed to you.

29.11

Merged the Alexander Hedges | Tue 15:15-17:00 | CHN E 42 and Maximillian Holst | Tue 15:15-17:00 | LFW C 4 groups. The class will be given by Alexander Hedges at the same time in LFW C 4.

28.11

Updated lecture slides 11 due to minor typos

23.11

Published style guide.

07.11

Updated lecture slides 8 due to minor typos

15.10

Updated lecture slides 3 and 4 due to minor typos

26.09 Your personal C++ playground
16.09

Registration to the Slack channel is open

Slack Channel Invitation

This is a plan. No plan survives contact with reality. We will constantly update lecture material before the lectures.

Week Date Topic Lecture Additional Material Exercises P Prerequisites to unlock bonus exercises B Bonus exercises
1 18.09 Introduction, First C++ Program Lecture
Handout DE ❘ EN
Video Part 1 ❘ Part 2
power8.cpp
Summary 01
C++ Tutorial
Organisational Information
Exercise 1 PDF
Tic-tac-toe
2 25.09 Integer Arithmetic and its Limits Lecture
Handout DE ❘ EN
Video
fahrenheit.cpp
bad_expression.cpp
limits.cpp
Summary 02
Self-Assessment I (solution)
Exercise 2 PDF
3 02.10 Boolean Functions, Safe Programming, Control Flow I Lecture
Handout DE ❘ EN
Video
gcd.cpp
sum_first_n.cpp
is_prime.cpp
Ariane 5 Video ❘ Details
Summary 03
Exercise 3 PDF
4 09.10 Control Flow II, Floating Point I Lecture
Handout DE ❘ EN
is_prime.cpp
collatz.cpp
calc.cpp
loops.cpp
holes.cpp
Break Continue
Summary 04
Exercise session handout
Exercise 4 PDF Tic-tac-toe
5 16.10 Floating Point II, Functions I Lecture
Handout DE ❘ EN
Video
accuracy.cpp
show_bits.cpp
harmonic.cpp
hundredten.cpp
IEEE-754 Converter
Summary 05
Exercise session handout
Comparing Floating Points
Floating Point Guidelines
Exercise 5 PDF Sudoku
6 23.10 Functions II, Reference Types I Lecture
Handout DE ❘ EN
Video
Code Examples
clicker:IntervallIntersect
clicker:FunctionsAndEffects
Summary 06
Function Exercise 1
Function Exercise 2
Self-Assessment II (solution)
Exercise 6 PDF
7 30.10 Reference Types II, Vectors and Strings Lecture
Handout DE ❘ EN
Video
Code Examples
clicker:References
clicker:Vectors
Summary 07
Exercise session handout
An Exercise on References
Exercise 7 PDF
Additional Practice Material: Converting Numbers
Additional Practice Material: Floating Points
8 06.11 Vectors and Strings II, Recursion I Lecture
Handout DE ❘ EN
Video
Code Examples
clicker:ShortestPath
clicker:Recursion
Summary 08
An Exercise on Recursion
Towers of Hanoi ENG
Exercise 8 PDF
Sudoku
9 13.11 Recursion II, Structs and Overloading Lecture
Handout DE ❘ EN
Video
Code Examples
clicker:Rekursion(2)
clicker:EBNF
nice BNF explanation (German) Summary 09
Exercise 9 PDF
3rd project
10 20.11 Structs, Encapsulation and Classes Lecture
Handout DE ❘ EN
Video
Code Examples
clicker:Operator_Overloading
story 1 result
story 2 result
Summary 10
Self-Assessment III (solution)
Exercise 10 PDF
11 27.11 Dynamic Data Types and Pointers Lecture
Handout DE ❘ EN
Video
Code Examples
Additional Pointer Slides
Clicker: Pointers I
Summary 11
Introduction to Pointers
Pointer Arithmetic
Applying Pointers
Exercise 11 PDF
12 04.12 Iterators and Containers Lecture
Handout DE ❘ EN
Video
Code Examples
Clicker: Pointers II
Clicker: Recursive Structs
Summary 12
Exercise 12 PDF
3rd project
13 11.12 Memory Management with Classes Lecture
Handout DE ❘ EN
Video
Code Examples
Clicker: Constructors(1)
Clicker: Constructors(2)
Clicker: Classes
Summary 13
Memory Management Exercise
Exercise 13 PDF
Self-Assessment IV (solution)
14 18.12 Subtyping, Polymorphism and Inheritance Lecture
Handout DE ❘ EN
Video
Code Examples
Exercise 14 PDF

Registration for the exercise session

The registration for exercise sessions is already open: click here, log in with your nethz account and enrol in one of the listed exercise sessions.

Time and place

The following exercise sessions are offered:

Time Place Assistant
Tue 15:15-17:00CAB G 59 Adrian Langenbach
Tue 15:15-17:00CHN D 44 Christopher Lehner
Tue 15:15-17:00CHN D 48 David Sommer
Tue 15:15-17:00CHN E 42 LFW C 4Alexander Hedges
Tue 15:15-17:00HG D 5.1 Eliza Wszola (EN)
Tue 15:15-17:00HG E 33.5Vytautas Astrauskas (EN)
Tue 15:15-17:00HG F 26.3Yannik Ammann
Tue 15:15-17:00HG F 26.5Moritz Schneider
Tue 15:15-17:00LFW C 4 Maximillian Holst Alexander Hedges
Wed 10:15-12:00ML H 41.1Viera Klasovita
Wed 10:15-12:00HG D 3.1 Benjamin Rothenberger
Wed 10:15-12:00HG D 3.3 Corminboeuf Etienne
Wed 10:15-12:00HG D 5.1 David Baur
Wed 10:15-12:00HG D 5.3 Max Egli
Wed 10:15-12:00HG E 21 Orhan Saeedi
Wed 10:15-12:00HG E 33.5Patrik Hadorn
Wed 10:15-12:00HG F 26.3Philippe Schlattner
Wed 10:15-12:00HG G 26.3Tobias Klenze
Wed 10:15-12:00LFV E 41 Sefidgar Seyed Reza (EN)

Assistants marked with EN teach in English, all others in German.

Bonus exercises

There will be 3 bonus exercises during the semester (see the agenda above for the schedule). By solving these exercises you will get up to 0.25 grade points added on top of your exam grade. In order to access the bonus exercises you need to unlock them in Code Expert by solving assignments from previous weeks and earning sufficiently many experience points (XP).

Contact

To facilitate the introduction to the lecture, especially for beginners in programming, we will provide an introductory tutorial, which can be completed autonomously. We strongly recommend to complete it in the first week of the semester.

C++ Tutorial Öffnen

Hint: The tutorial is available in both German and English. You can switch the language any time.

Old Exams

In order to get access to old exams and master solutions, please mark that you have understood the statement.

Bjarne Stroustrup: Einführung in die Programmierung mit C++, Pearson Studium, 2010 | Also available online from the ETH Domain

Stephen Prata, C++ Primer Plus, Sixth Edition, Addison Wesley, 2012

Andrew Koenig and Barbara E. Moo: Accelerated C++, Addison-Wesley, 2000.

Script

Prof. Dr. Bernd Gärtner and Dr. Michael Hoffmann kindly provided a script (lecture notes) that covers the material presented in the lecture.

Other useful resources