diff --git a/20191128/hp-musterloesung-20191128.pdf b/20191128/hp-musterloesung-20191128.pdf new file mode 100644 index 0000000000000000000000000000000000000000..a8adbf2b369d7073ba44f6aa9791ac4bb8d4ac2d Binary files /dev/null and b/20191128/hp-musterloesung-20191128.pdf differ diff --git a/20191128/hp-musterloesung-20191128.tex b/20191128/hp-musterloesung-20191128.tex new file mode 100644 index 0000000000000000000000000000000000000000..fcfee6bff213e6bb5404d0c0bfdae3918e7b4d70 --- /dev/null +++ b/20191128/hp-musterloesung-20191128.tex @@ -0,0 +1,278 @@ +% hp-musterloesung-20191128.pdf - Solutions to the Exercises on Low-Level Programming +% Copyright (C) 2013, 2015, 2016, 2017, 2018, 2019 Peter Gerwinski +% +% This document is free software: you can redistribute it and/or +% modify it either under the terms of the Creative Commons +% Attribution-ShareAlike 3.0 License, or under the terms of the +% GNU General Public License as published by the Free Software +% Foundation, either version 3 of the License, or (at your option) +% any later version. +% +% This document is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this document. If not, see <http://www.gnu.org/licenses/>. +% +% You should have received a copy of the Creative Commons +% Attribution-ShareAlike 3.0 Unported License along with this +% document. If not, see <http://creativecommons.org/licenses/>. + +% README: Datum-Bibliothek, Text-Grafik-Bibliothek, LED-Blinkmuster + +\documentclass[a4paper]{article} + +\usepackage{pgscript} +\usepackage{sfmath} + +\begin{document} + + \section*{Hardwarenahe Programmierung\\ + Musterlösung zu den Übungsaufgaben -- 28.\ November 2019} + + \exercise{Datum-Bibliothek} + + Zerlegen Sie die Datum-Bibliothek aus der Übungsaufgabe 2 vom 7.\,11.\,2019 + in eine \file{.c}- und eine \file{.h}-Datei. \points{4} + + Hinweis: Schreiben Sie zusätzlich ein Test-Programm. + + \solution + + Die Dateien \gitfile{hp}{20191128}{dates.c} und \gitfile{hp}{20191128}{dates.h} enthalten die Bibliothek, + die Datei \gitfile{hp}{20191128}{test-dates.c} ein Programm zum Testen der Bibliothek. + + \exercise{Text-Grafik-Bibliothek} + + Schreiben Sie eine Bibliothek für "`Text-Grafik"' mit folgenden Funktionen:\vspace*{-\medskipamount} + \begin{itemize} + \item + \lstinline|void clear (char c)|\\ + Bildschirm auf Zeichen \lstinline|c| löschen,\\ + also komplett mit diesem Zeichen (z.\,B.: Leerzeichen) füllen + \item + \lstinline|void put_point (int x, int y, char c)|\\ + Punkt setzen (z.\,B.\ einen Stern (\lstinline{*}) an die Stelle $(x,y)$ "`malen"') + \item + \lstinline|char get_point (int x, int y)|\\ + Punkt lesen +% \item +% \lstinline|void fill (int x, int y, char c, char o)|\\ +% Fläche in der "`Farbe"' \lstinline|o|, +% die den Punkt \lstinline|(x, y)| enthält, +% mit der "`Farbe"' \lstinline|c| ausmalen + \item + \lstinline|void display (void)|\\ + das Gezeichnete auf dem Bildschirm ausgeben + \end{itemize} + + Hinweise:\vspace*{-\medskipamount} + \begin{itemize} + \item + Eine C-Bibliothek besteht aus (mindestens) + einer \file{.h}-Datei und einer \file{.c}-Datei. + \item + Verwenden Sie ein Array als "`Bildschirm"'. + + Vor dem Aufruf der Funktion \lstinline|display()| ist nichts zu sehen;\\ + alle Grafikoperationen erfolgen auf dem Array. + \item + Verwenden Sie Präprozessor-Konstante, + z.\,B.\ \lstinline{WIDTH} und \lstinline{HEIGHT},\\ + um Höhe und Breite des "`Bildschirms"' festzulegen: + \begin{lstlisting}[gobble=8] + #define WIDTH 72 + #define HEIGHT 24 + \end{lstlisting} + \item + Schreiben Sie zusätzlich ein Test-Programm, + das alle Funktionen der Bibliothek benutzt,\\ + um ein hübsches Bild (z.\,B.\ ein stilisiertes Gesicht -- "`Smiley"') + auszugeben. + \end{itemize} + \points{8} + + \solution + + Siehe die Dateien \gitfile{hp}{20191128}{textgraph.c} und \gitfile{hp}{20191128}{textgraph.h} (Bibliothek) + sowie \gitfile{hp}{20191128}{test-textgraph.c} (Test-Programm). + + Diese Lösung erfüllt zusätzlich die Aufgabe, + bei fehlerhafter Benutzung (Koordinaten außerhalb des Zeichenbereichs) + eine sinnvolle Fehlermeldung auszugeben, + anstatt unkontrolliert Speicher zu überschreiben und abzustürzen. + + Das Schlüsselwort \lstinline{static} + bei der Deklaration der Funktion \lstinline{check_coordinates()} + bedeutet, daß diese Funktion nur lokal (d.\,h.\ innerhalb der Bibliothek) + verwendet und insbesondere nicht nach außen + (d.\,h.\ für die Benutzung durch das Hauptprogramm) exportiert wird. + Dies dient dazu, nicht unnötig Bezeichner zu reservieren + (Vermeidung von "`Namensraumverschmutzung"'). + + Man beachte die Verwendung einfacher Anführungszeichen (Apostrophe) + bei der Angabe von \lstinline{char}-Kon"-stanten (\lstinline{'*'}) + im Gegensatz zur Verwendung doppelter Anführungszeichen + bei der Angabe von String-Konstanten + (String = Array von \lstinline{char}s, abgeschlossen mit Null-Symbol). + Um das einfache Anführungszeichen selbst als \lstinline{char}-Konstante anzugeben, + ist ein vorangestellter Backslash erforderlich: \lstinline{'\''} ("`Escape-Sequenz"'). + Entsprechendes gilt für die Verwendung doppelter Anführungszeichen + innerhalb von String-Konstanten: + \lstinline{printf ("Your name is: \"%s\"", name);} + + \exercise{LED-Blinkmuster} + + Wir betrachten das folgende Programm für einen ATmega32-Mikro-Controller + (Datei: \gitfile{hp}{20191128}{aufgabe-3.c}). + + \begin{minipage}[t]{7cm} + \begin{lstlisting}[gobble=6] + #include <stdint.h> + #include <avr/io.h> + #include <avr/interrupt.h> + + uint8_t counter = 1; + uint8_t leds = 0; + + ISR (TIMER0_COMP_vect) + { + if (counter == 0) + { + leds = (leds + 1) % 8; + PORTC = leds << 4; + } + counter++; + } + \end{lstlisting} + \end{minipage}\hfill\begin{minipage}[t]{8.5cm} + \begin{lstlisting}[gobble=6] + void init (void) + { + cli (); + TCCR0 = (1 << CS01) | (1 << CS00); + TIMSK = 1 << OCIE0; + sei (); + DDRC = 0x70; + } + + int main (void) + { + init (); + while (1) + ; /* do nothing */ + return 0; + } + \end{lstlisting} + \end{minipage} + + An die Bits Nr.\ 4, 5 und 6 des Output-Ports C des Mikro-Controllers sind LEDs angeschlossen.\\ + Sobald das Programm läuft, blinken diese in charakteristischer Weise: + \begin{quote} + \newcommand{\tdn}[1]{\raisebox{-2pt}{#1}} + \begin{tabular}{|c|c|c|c|}\hline + \tdn{Phase} & \tdn{LED oben (rot)} & \tdn{LED Mitte (gelb)} & \tdn{LED unten (grün)} \\[2pt]\hline + 1 & aus & aus & an \\\hline + 2 & aus & an & aus \\\hline + 3 & aus & an & an \\\hline + 4 & an & aus & aus \\\hline + 5 & an & aus & an \\\hline + 6 & an & an & aus \\\hline + 7 & an & an & an \\\hline + 8 & aus & aus & aus \\\hline + \end{tabular} + \end{quote} + Jede Phase dauert etwas länger als eine halbe Sekunde. + Nach 8 Phasen wiederholt sich das Schema. + + Erklären Sie das Verhalten des Programms anhand des Quelltextes: + \vspace{-\medskipamount} + \begin{itemize}\itemsep0pt + \item[(a)] + Wieso macht das Programm überhaupt etwas, + wenn doch das Hauptprogramm nach dem Initialisieren lediglich eine Endlosschleife ausführt, + in der \emph{nichts} passiert? + \points{1} + \item[(b)] + Wieso wird die Zeile \lstinline|PORTC = leds << 4;| überhaupt aufgerufen, + wenn dies doch nur unter der Bedingung \lstinline|counter == 0| passiert, + wobei die Variable \lstinline|counter| auf 1 initialisiert, + fortwährend erhöht und nirgendwo zurückgesetzt wird? + \points{2} + \item[(c)] + Wie kommt das oben beschriebene Blinkmuster zustande? + \points{2} + \item[(d)] + Wieso dauert eine Phase ungefähr eine halbe Sekunde? + \points{2} + \item[(e)] + Was bedeutet "`\lstinline|ISR (TIMER0_COMP_vect)|"'? + \points{1} + \end{itemize} + + \goodbreak + Hinweis: + \vspace{-\medskipamount} + \begin{itemize}\itemsep0pt + \item + Die Funktion \lstinline|init()| sorgt dafür, daß der Timer-Interrupt Nr.\ 0 des Mikro-Controllers + etwa 488mal pro Sekunde aufgerufen wird. + Außerdem initialisiert sie die benötigten Bits an Port C als Output-Ports. + Sie selbst brauchen die Funktion \lstinline|init()| nicht weiter zu erklären. + \end{itemize} + + \solution + + \begin{itemize}\itemsep0pt + \item[(a)] + \textbf{Wieso macht das Programm überhaupt etwas, + wenn doch das Hauptprogramm nach dem Initialisieren lediglich eine Endlosschleife ausführt, + in der \emph{nichts} passiert?} + + Das Blinken wird durch einen Interrupt-Handler implementiert. + Dieser wird nicht durch das Hauptprogramm, + sondern durch ein Hardware-Ereignis (hier: Uhr) aufgerufen. + + \item[(b)] + \textbf{Wieso wird die Zeile \lstinline|PORTC = leds << 4;| überhaupt aufgerufen, + wenn dies doch nur unter der Bedingung \lstinline|counter == 0| passiert, + wobei die Variable \lstinline|counter| auf 1 initialisiert, + fortwährend erhöht und nirgendwo zurückgesetzt wird?} + + Die vorzeichenlose 8-Bit-Variable \lstinline{counter} kann nur + Werte von 0 bis 255 annehmen; bei einem weiteren + INkrementieren springt sie wieder auf 0 (Überlauf), + und die \lstinline{if}-Bedingung ist erfüllt. + + \item[(c)] + \textbf{Wie kommt das oben beschriebene Blinkmuster zustande?} + + In jedem Aufruf des Interrupt-Handlers wird die Variable + \lstinline{leds} um 1 erhöht und anschließend modulo 8 genommen. + Sie durchläuft daher immer wieder die Zahlen von 0 bis 7. + + Durch die Schiebeoperation \lstinline{leds << 4} werden die 3 Bits + der Variablen \lstinline{leds} an diejenigen Stellen im Byte + geschoben, an denen die LEDs an den Mikro-Controller + angeschlossen sind (Bits 4, 5 und 6). + + Entsprechend durchläuft das Blinkmuster immer wieder + die Binärdarstellungen der Zahlen von 0 bis 7 + (genauer: von 1 bis 7 und danach 0). + + \item[(d)] + \textbf{Wieso dauert eine Phase ungefähr eine halbe Sekunde?} + + Der Interrupt-Handler wird gemäß Hinweis 488mal pro Sekunde aufgerufen. + Bei jedem 256sten Aufruf ändert sich das LED-Muster. + Eine Phase dauert somit $\frac{256}{488} \approx 0.52$ Sekunden. + + \item[(e)] + \textbf{Was bedeutet "`\lstinline|ISR (TIMER0_COMP_vect)|"'?} + + Deklaration eines Interrupt-Handlers für den Timer-Interrupt Nr.\ 0 + \end{itemize} + +\end{document} diff --git a/20200123/hello-gtk.png b/20200123/hello-gtk.png new file mode 120000 index 0000000000000000000000000000000000000000..cca99209d86683a9a3b0f70bbc149780bae10ba6 --- /dev/null +++ b/20200123/hello-gtk.png @@ -0,0 +1 @@ +../common/hello-gtk.png \ No newline at end of file diff --git a/20200123/hp-20200123.pdf b/20200123/hp-20200123.pdf new file mode 100644 index 0000000000000000000000000000000000000000..49af789dfc725f295aafce3c8a8d50e440c467c9 Binary files /dev/null and b/20200123/hp-20200123.pdf differ diff --git a/20200123/hp-20200123.tex b/20200123/hp-20200123.tex new file mode 100644 index 0000000000000000000000000000000000000000..38285760dbf24d041fc88dab65310ac4a66f071c --- /dev/null +++ b/20200123/hp-20200123.tex @@ -0,0 +1,1127 @@ +% hp-20200123.pdf - Lecture Slides on Low-Level Programming +% Copyright (C) 2012, 2013, 2015, 2016, 2017, 2018, 2019, 2020 Peter Gerwinski +% +% This document is free software: you can redistribute it and/or +% modify it either under the terms of the Creative Commons +% Attribution-ShareAlike 3.0 License, or under the terms of the +% GNU General Public License as published by the Free Software +% Foundation, either version 3 of the License, or (at your option) +% any later version. +% +% This document is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this document. If not, see <http://www.gnu.org/licenses/>. +% +% You should have received a copy of the Creative Commons +% Attribution-ShareAlike 3.0 Unported License along with this +% document. If not, see <http://creativecommons.org/licenses/>. + +% README: Objektorientierte Programmierung, Datenstrukturen + +\documentclass[10pt,t]{beamer} + +\usepackage{pgslides} +\usepackage{tikz} +\usepackage{rotating} + +\usefonttheme[onlymath]{serif} + +\definecolor{medcyan}{rgb}{0.0,0.5,0.7} + +\title{Hardwarenahe Programmierung} +\author{Prof.\ Dr.\ rer.\ nat.\ Peter Gerwinski} +\date{23.\ Januar 2020} + +\begin{document} + +\maketitleframe + +\nosectionnonumber{\inserttitle} + +\begin{frame} + + \shownosectionnonumber + + \begin{itemize} + \item[\textbf{1}] \textbf{Einführung} + \hfill\makebox(0,0)[br]{\raisebox{2.25ex}{\url{https://gitlab.cvh-server.de/pgerwinski/hp}}} + \item[\textbf{2}] \textbf{Einführung in C} + \item[\textbf{3}] \textbf{Bibliotheken} + \item[\textbf{4}] \textbf{Hardwarenahe Programmierung} + \item[\textbf{5}] \textbf{Algorithmen} + \item[\textbf{6}] \textbf{Objektorientierte Programmierung} + \begin{itemize} + \color{medgreen} + \item[6.0] Dynamische Speicherverwaltung + \color{black} + \item[6.1] Konzepte und Ziele + \item[6.2] Beispiel: Zahlen und Buchstaben + \color{medgreen} + \item[6.3] Unions + \item[6.4] Virtuelle Methoden + \color{red} + \item[6.5] Beispiel: Graphische Benutzeroberfläche (GUI) + \item[6.6] Ausblick: C++ + \end{itemize} + \item[\textbf{7}] \textbf{Datenstrukturen} + \begin{itemize} + \color{red} + \item[7.1] Stack und FIFO + \vspace*{-\smallskipamount} + \item[\dots] + \end{itemize} + \end{itemize} + +\end{frame} + +\setcounter{section}{5} +\section{Objektorientierte Programmierung} +\addtocounter{subsection}{-1} +\subsection{Dynamische Speicherverwaltung} + +\begin{frame}[fragile] + + \showsection + \showsubsection + + \begin{itemize} + \item + Array: feste Anzahl von Elementen desselben Typs (z.\,B.\ 3 ganze Zahlen) + \item + Dynamisches Array: variable Anzahl von Elementen desselben Typs + \end{itemize} + + \bigskip + + \begin{lstlisting} + char *name[] = { "Anna", "Berthold", "Caesar" }; + + ... + + name[3] = "Dieter"; + \end{lstlisting} + + \begin{picture}(0,0) + \color{red} + \put(0,0){\line(3,1){3.5}} + \put(0,1){\line(3,-1){3.5}} + \end{picture} + +\end{frame} + +\begin{frame}[fragile] + + \showsection + \showsubsection + + \bigskip + + \begin{lstlisting} + #include <stdlib.h> + + ... + + char **name = malloc (3 * sizeof (char *)); + /* Speicherplatz für 3 Zeiger anfordern */ + + ... + + free (name) + /* Speicherplatz freigeben */ + + \end{lstlisting} + +\end{frame} + +\subsection{Konzepte und Ziele} + +\begin{frame} + + \showsection + \showsubsection + + \begin{itemize} + \item +% Array: feste Anzahl von Elementen desselben Typs (z.\,B.\ 3 ganze Zahlen) + Array: Elemente desselben Typs (z.\,B.\ 3 ganze Zahlen) +% \item +% Dynamisches Array: variable Anzahl von Elementen desselben Typs + \item + Problem: Elemente unterschiedlichen Typs + \item + Lösung: den Typ des Elements zusätzlich speichern + \end{itemize} + \begin{itemize} + \item + Funktionen, die mit dem Objekt arbeiten: \newterm{Methoden} + \begin{onlyenv}<1> + \item + Was die Funktion bewirkt,\\ + hängt vom Typ des Objekts ab + \item + Realisierung über endlose \lstinline{if}-Ketten + \end{onlyenv} + \begin{onlyenv}<2> + \item + Was die Funktion bewirkt + \begin{picture}(0,0) + \color{red} + \put(-4.00,-0.10){\tikz{\draw[thick](0,0.25)--(3.75,-0.05);% + \draw[thick](-0.1,-0.05)--(3.75,0.3);}} + \end{picture}% + Welche Funktion aufgerufen wird,\\ + hängt vom Typ des Objekts ab: \newterm{virtuelle Methode} + \item + Realisierung über endlose \lstinline{if}-Ketten% + \begin{picture}(0,0) + \color{red} + \put(-2.75,-0.10){\tikz{\draw[thick](0,0.25)--(2.5,-0.05);% + \draw[thick](-0.1,-0.05)--(2.5,0.3);}} +% \put(1.5,-1.1){\begin{rotate}{7}\large\bf\textarrow\ +% kommt gleich +% nächste Woche +% \end{rotate}} + \end{picture} + Zeiger, die im Objekt gespeichert sind\\ + (Genaugenommen: Tabelle von Zeigern) + \end{onlyenv} + \end{itemize} + +\end{frame} + +\begin{frame} + + \showsection + \showsubsection + + \begin{itemize} + \item + Problem: Elemente unterschiedlichen Typs + \item + Lösung: den Typ des Elements zusätzlich speichern + \item + \newterm{Methoden\/} und \newterm{virtuelle Methoden} + \end{itemize} + + \begin{itemize} + \item + Zeiger auf verschiedene Strukturen\\ + mit einem gemeinsamen Anteil von Datenfeldern\\ + \textarrow\ "`verwandte"' \newterm{Objekte}, \newterm{Klassen} von Objekten + \item + Struktur, die \emph{nur\/} den gemeinsamen Anteil enthält\\ + \textarrow\ "`Vorfahr"', \newterm{Basisklasse}, \newterm{Vererbung} + \item +% Explizite Typumwandlung eines Zeigers auf die Basisklasse\\ +% in einen Zeiger auf die \newterm{abgeleitete Klasse}\\ +% \textarrow\ Man kann ein Array unterschiedlicher Objekte\\ +% \strut\phantom{\textarrow} in einer Schleife abarbeiten.\\ + Zeiger auf die Basisklasse dürfen auf Objekte\\ + der \newterm{abgeleiteten Klasse} zeigen\\ + \textarrow\ \newterm{Polymorphie} + \end{itemize} + +\end{frame} + +\subsection{Beispiel: Zahlen und Buchstaben} + +\begin{frame}[fragile] + + \showsection + \showsubsection + + \begin{center} + \begin{minipage}{5cm} + \begin{lstlisting}[gobble=8] + ¡typedef struct + { + int type; + } t_base;¿ + \end{lstlisting} + \end{minipage}\\[0.5cm] + \begin{minipage}{5cm} + \begin{lstlisting}[gobble=8] + ¡typedef struct + { + int type; + int content; + } t_integer;¿ + \end{lstlisting} + \end{minipage} + \begin{minipage}{5cm} + \begin{lstlisting}[gobble=8] + ¡typedef struct + { + int type; + char *content; + } t_string;¿ + \end{lstlisting} + \end{minipage} + \end{center} + +\end{frame} + +\begin{frame}[fragile] + \begin{center} + \begin{minipage}{5cm} + \begin{lstlisting}[gobble=8] + ¡typedef struct + { + int type; + } t_base;¿ + \end{lstlisting} + \end{minipage}\\[0.5cm] + \begin{minipage}{5cm} + \begin{lstlisting}[gobble=8] + ¡typedef struct + { + int type; + int content; + } t_integer;¿ + \end{lstlisting} + \end{minipage} + \begin{minipage}{5cm} + \begin{lstlisting}[gobble=8] + ¡typedef struct + { + int type; + char *content; + } t_string;¿ + \end{lstlisting} + \end{minipage}\\[0.7cm] + \begin{onlyenv}<1> + \begin{minipage}{8cm} + \begin{lstlisting}[gobble=10] + ¡t_integer i = { 1, 42 }; + t_string s = { 2, "Hello, world!" }; + + t_base *object[] = { (t_base *) &i, (t_base *) &s };¿ + \end{lstlisting} + \end{minipage}% + \begin{picture}(0,0) + \color{red} + \put(-5.4,-0.8){\mbox{$\underbrace{\rule{1.45cm}{0pt}}_{\shortstack{\strut explizite\\Typumwandlung}}$}} + \end{picture} + \end{onlyenv} +% \begin{onlyenv}<2> +% \begin{minipage}{5cm} +% \begin{lstlisting}[gobble=10] +% ¡typedef union +% { +% t_base base; +% t_integer integer; +% t_string string; +% } t_object;¿ +% \end{lstlisting} % \end{minipage} +% \end{onlyenv} + \end{center} + +\end{frame} + +\subsection{Unions} + +\begin{frame}[fragile] + + \showsubsection + + Variable teilen sich denselben Speicherplatz. + + \medskip + + \begin{minipage}[t]{3.7cm} + \begin{lstlisting}[gobble=6] + ¡typedef union + { + int8_t i; + uint8_t u; + } num8_t;¿ + \end{lstlisting} + \end{minipage}% + \begin{minipage}[t]{4.5cm} + \begin{lstlisting}[gobble=6] + ¡int main (void) + { + num8_t test; + test.i = -1; + printf ("%d\n", test.u); + return 0; + }¿ + \end{lstlisting} + \end{minipage} + +\end{frame} + +\begin{frame}[fragile] + + \showsubsection + + Variable teilen sich denselben Speicherplatz. + + \medskip + + \begin{minipage}[t]{3.7cm} + \begin{lstlisting}[gobble=6] + ¡typedef union + { + char s[8]; + uint64_t x; + } num_char_t;¿ + \end{lstlisting} + \end{minipage}% + \begin{minipage}[t]{4.5cm} + \begin{lstlisting}[gobble=6] + ¡int main (void) + { + num_char_t test = { "Hello!" }; + printf ("%lx\n", test.x); + return 0; + }¿ + \end{lstlisting} + \end{minipage} + +\end{frame} + +\begin{frame}[fragile] + + \showsubsection + + Variable teilen sich denselben Speicherplatz. + + \medskip + + \begin{minipage}[t]{3.7cm} + \begin{lstlisting}[gobble=6] + ¡typedef union + { + t_base base; + t_integer integer; + t_string string; + } t_object;¿ + \end{lstlisting} + \end{minipage}% + \begin{minipage}[t]{3.0cm} + \begin{lstlisting}[gobble=6] + + ¡typedef struct + { + int type; + } t_base;¿ + \end{lstlisting} + \end{minipage}% + \begin{minipage}[t]{3.0cm} + \begin{lstlisting}[gobble=6] + + ¡typedef struct + { + int type; + int content; + } t_integer;¿ + \end{lstlisting} + \end{minipage}% + \begin{minipage}[t]{3.0cm} + \begin{lstlisting}[gobble=6] + + ¡typedef struct + { + int type; + char *content; + } t_string;¿ + \end{lstlisting} + \end{minipage} + + \bigskip + + \begin{center} + \begin{minipage}{8.5cm} + \begin{lstlisting}[gobble=8] + ¡if (this->base.type == T_INTEGER) + printf ("Integer: %d\n", this->integer.content); + else if (this->base.type == T_STRING) + printf ("String: \"%s\"\n", this->string.content);¿ + \end{lstlisting} + \end{minipage} + \end{center} + +\end{frame} + +\subsection{Virtuelle Methoden} + +\begin{frame}[fragile] + \showsubsection + + \begin{lstlisting} + void print_object (t_object *this) + { + if (this->base.type == T_INTEGER) + printf ("Integer: %d\n", this->integer.content); + else if (this->base.type == T_STRING) + printf ("String: \"%s\"\n", this->string.content); + } + \end{lstlisting} + + \begin{picture}(0,0) + \color{red} + \put(9,1.7){\shortstack[l]{if-Kette:\\\strut wird unübersichtlich}} + \put(1,-2){\mbox{\textarrow}} + \put(0,-3){\mbox{Zeiger auf Funktionen}} + \end{picture} + + \begin{lstlisting}[xleftmargin=4cm] + void print_integer (t_object *this) + { + printf ("Integer: %d\n", this->integer.content); + } + + void print_string (t_object *this) + { + printf ("String: \"%s\"\n", this->string.content); + } + \end{lstlisting} + +\end{frame} + +\begin{frame}[fragile] + \showsubsection + + Zeiger auf Funktionen + + \medskip + + \begin{lstlisting} + void (* print) (t_object *this); + \end{lstlisting} + \begin{picture}(0,1.2)(0,-0.9) + \color{red} + \put(0.95,0.3){\mbox{$\underbrace{\rule{1cm}{0pt}}$}} + \put(0.2,-0.7){\shortstack{das, worauf print zeigt,\\ist eine Funktion}} + \end{picture} + + \begin{itemize} + \item + Objekt enthält Zeiger auf Funktion + \begin{onlyenv}<1> + \medskip + \begin{lstlisting}[gobble=10] + typedef struct + { + void (* print) (union t_object *this); + int content; + } t_integer; + \end{lstlisting} + \end{onlyenv} + \begin{onlyenv}<2-> + \vspace*{-3.5cm} % Why doesn't a picture environment work here??? :-( + \begin{lstlisting}[gobble=10,xleftmargin=5.5cm] + typedef struct + { + void (* print) (union t_object *this); + int content; + } t_integer; + \end{lstlisting} + \vspace*{0.85cm} + \bigskip + \smallskip + \end{onlyenv} + \pause + \item + Konstruktor initialisiert diesen Zeiger + \begin{onlyenv}<2> + \medskip + \begin{lstlisting}[gobble=10] + t_object *new_integer (int i) + { + t_object *p = malloc (sizeof (t_integer)); + p->integer.print = print_integer; + p->integer.content = i; + return p; + } + \end{lstlisting} + \vspace*{-2cm} + \end{onlyenv} + \pause + \item + Aufruf: "`automatisch"' die richtige Funktion + \begin{onlyenv}<3> + \medskip + \begin{lstlisting}[gobble=10] + for (int i = 0; object[i]; i++) + object[i]->base.print (object[i]); + \end{lstlisting} + \end{onlyenv} + \pause + \medskip + \item + in größeren Projekten:\\ + Objekt enthält Zeiger auf Tabelle von Funktionen + \end{itemize} +\end{frame} + +\subsection{Beispiel: Graphische Benutzeroberfläche (GUI)} + +\begin{frame}[fragile] + + \showsubsection + + \scriptsize + \begin{lstlisting} + #include <gtk/gtk.h> + + int main (int argc, char **argv) + { + gtk_init (&argc, &argv); + GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_window_set_title (GTK_WINDOW (window), "Hello"); + g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL); + GtkWidget *vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5); + gtk_container_add (GTK_CONTAINER (window), vbox); + gtk_container_set_border_width (GTK_CONTAINER (vbox), 10); + GtkWidget *label = gtk_label_new ("Hello, world!"); + gtk_container_add (GTK_CONTAINER (vbox), label); + GtkWidget *button = gtk_button_new_with_label ("Quit"); + g_signal_connect (button, "clicked", G_CALLBACK (gtk_main_quit), NULL); + gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_widget_show (button); + gtk_widget_show (label); + gtk_widget_show (vbox); + gtk_widget_show (window); + gtk_main (); + return 0; + } + \end{lstlisting} + + \vspace*{-6cm}\strut\hfill + \includegraphics[scale=0.85]{hello-gtk.png}\\[2cm] + \begin{flushright} + \normalsize\bf Praktikumsversuch:\\ + Objektorientiertes Zeichenprogramm + \end{flushright} + +\end{frame} + +\subsection{Ausblick: C++} + +\begin{frame}[fragile] + \showsubsection + + \begin{center} + \begin{minipage}{5cm} + \begin{lstlisting}[gobble=8] + ¡typedef struct + { + void (* print) (union t_object *this); + } t_base;¿ + \end{lstlisting} + \end{minipage}\\[0.5cm] + \begin{minipage}{5.5cm} + \begin{lstlisting}[gobble=8] + ¡typedef struct + { + void (* print) (...); + int content; + } t_integer;¿ + \end{lstlisting} + \end{minipage} + \begin{minipage}{5cm} + \begin{lstlisting}[gobble=8] + ¡typedef struct + { + void (* print) (union t_object *this); + char *content; + } t_string;¿ + \end{lstlisting} + \end{minipage} + \end{center} + +\end{frame} + +\begin{frame}[fragile] + \showsubsection + + \begin{center} + \begin{minipage}{5cm} + \begin{lstlisting}[gobble=8] + ¡struct TBase + { + virtual void print (void); + };¿ + \end{lstlisting} + \end{minipage}\\[0.5cm] + \begin{minipage}{5.5cm} + \begin{lstlisting}[gobble=8] + ¡struct TInteger: public TBase + { + virtual void print (void); + int content; + };¿ + \end{lstlisting} + \end{minipage} + \begin{minipage}{5cm} + \begin{lstlisting}[gobble=8] + ¡struct TString: public TBase + { + virtual void print (void); + char *content; + };¿ + \end{lstlisting} + \end{minipage} + \end{center} + +\end{frame} + +\section{Datenstrukturen} +\subsection{Stack und FIFO} + +\begin{frame}[fragile] + + \showsection + \showsubsection + + \begin{minipage}{0.48\textwidth} + Im letzten Praktikumsversuch: + \begin{itemize} + \item + Array nur zum Teil benutzt + \item + Variable speichert genutzte Länge + \item + Elemente hinten anfügen\\ + oder entfernen + \arrowitem + Stack\\ + \strut + \end{itemize} + \bigskip + \begin{itemize} + \item + hinten anfügen/entfernen: $\mathcal{O}(1)$\hspace*{-1cm} + \item + vorne oder in der Mitte einfügen/entfernen: $\mathcal{O}(n)$ + \end{itemize} + \end{minipage}\hfill + \begin{minipage}{0.52\textwidth} + Auch möglich: + \begin{itemize} + \item + Array nur zum Teil benutzt + \item + 2 Variable speichern\\genutzte Länge (ringförmig) + \item + Elemente hinten anfügen\\ + oder vorne entfernen + \arrowitem + FIFO + \end{itemize} + \bigskip + \begin{itemize} + \item + vorne oder hinten\\ + anfügen oder entfernen: $\mathcal{O}(1)$ + \item + in der Mitte einfügen/entfernen: $\mathcal{O}(n)$ + \end{itemize} + \end{minipage}\hspace*{-1.5mm} + +\end{frame} + +\begin{frame}[fragile] + + \showsection + \showsubsection + + \bigskip + + \begin{minipage}[b]{6cm} + \begin{center} + "`First In -- First Out"' + + \bigskip + + \begin{picture}(6,4) + \thicklines + \color{structure} + \put(0.5,0){\line(1,0){5}} + + \put(3.5,0){\only<1-5>{\line(0,1){1}}} + \put(4.5,0){\only<1-4>{\line(0,1){1}}} + \put(3.5,1){\only<1-4>{\line(1,0){1}}} + \put(4.0,0.5){\only<1-4>{\makebox(0,0){\lstinline{3}}}} + \put(3.0,1.5){\only<1>{\makebox(0,0)[tl]{\tikz{\draw[-latex, line width=1pt](0,0)--(0.45,-0.45);}}}} + \put(3.0,1.5){\only<1>{\makebox(0,0)[b]{\lstinline{push (3)}}}} + + \put(2.5,0){\only<2-6>{\line(0,1){1}}} + \put(2.5,1){\only<2-5>{\line(1,0){1}}} + \put(3.0,0.5){\only<2-5>{\makebox(0,0){\lstinline{7}}}} + \put(2.0,1.5){\only<2>{\makebox(0,0)[tl]{\tikz{\draw[-latex, line width=1pt](0,0)--(0.45,-0.45);}}}} + \put(2.0,1.5){\only<2>{\makebox(0,0)[b]{\lstinline{push (7)}}}} + + \put(1.5,0){\only<3-6>{\line(0,1){1}}} + \put(1.5,1){\only<3-6>{\line(1,0){1}}} + \put(2.0,0.5){\only<3-6>{\makebox(0,0){\lstinline{137}}}} + \put(1.0,1.5){\only<3>{\makebox(0,0)[tl]{\tikz{\draw[-latex, line width=1pt](0,0)--(0.45,-0.45);}}}} + \put(1.0,1.5){\only<3>{\makebox(0,0)[b]{\lstinline{push (137)}}}} + + \put(4.55,1.05){\only<4>{\makebox(0,0)[bl]{\tikz{\draw[-latex, line width=1pt](0,0)--(0.45,0.45);}}}} + \put(5.00,1.60){\only<4>{\makebox(0,0)[b]{\lstinline{pop ()}: 3}}} + + \put(3.55,1.05){\only<5>{\makebox(0,0)[bl]{\tikz{\draw[-latex, line width=1pt](0,0)--(0.45,0.45);}}}} + \put(4.00,1.60){\only<5>{\makebox(0,0)[b]{\lstinline{pop ()}: 7}}} + + \put(2.55,1.05){\only<6>{\makebox(0,0)[bl]{\tikz{\draw[-latex, line width=1pt](0,0)--(0.45,0.45);}}}} + \put(3.00,1.60){\only<6>{\makebox(0,0)[b]{\lstinline{pop ()}: 137}}} + \end{picture} + + \bigskip + + FIFO = Queue = Reihe + \end{center} + \end{minipage}\hfill + \begin{minipage}[b]{6cm} + \begin{center} + "`Last In -- First Out"' + + \bigskip + + \begin{picture}(6,4) + \thicklines + \color{structure} + \put(1.5,0){\line(1,0){3}} + + \put(2.5,0){\line(0,1){1}} + \put(3.5,0){\line(0,1){1}} + \put(2.5,1){\line(1,0){1}} + \put(3.0,0.5){\makebox(0,0){\lstinline{3}}} + \put(2.0,1.5){\only<1>{\makebox(0,0)[tl]{\tikz{\draw[-latex, line width=1pt](0,0)--(0.45,-0.45);}}}} + \put(2.0,1.5){\only<1>{\makebox(0,0)[b]{\lstinline{push (3)}}}} + + \put(2.5,1){\only<2-5>{\line(0,1){1}}} + \put(3.5,1){\only<2-5>{\line(0,1){1}}} + \put(2.5,2){\only<2-5>{\line(1,0){1}}} + \put(3.0,1.5){\only<2-5>{\makebox(0,0){\lstinline{7}}}} + \put(2.0,2.5){\only<2>{\makebox(0,0)[tl]{\tikz{\draw[-latex, line width=1pt](0,0)--(0.45,-0.45);}}}} + \put(2.0,2.5){\only<2>{\makebox(0,0)[b]{\lstinline{push (7)}}}} + + \put(2.5,2){\only<3-4>{\line(0,1){1}}} + \put(3.5,2){\only<3-4>{\line(0,1){1}}} + \put(2.5,3){\only<3-4>{\line(1,0){1}}} + \put(3.0,2.5){\only<3-4>{\makebox(0,0){\lstinline{137}}}} + \put(2.0,3.5){\only<3>{\makebox(0,0)[tl]{\tikz{\draw[-latex, line width=1pt](0,0)--(0.45,-0.45);}}}} + \put(2.0,3.5){\only<3>{\makebox(0,0)[b]{\lstinline{push (137)}}}} + + \put(3.55,3.05){\only<4>{\makebox(0,0)[bl]{\tikz{\draw[-latex, line width=1pt](0,0)--(0.45,0.45);}}}} + \put(4.00,3.60){\only<4>{\makebox(0,0)[b]{\lstinline{pop ()}: 137}}} + + \put(3.55,2.05){\only<5>{\makebox(0,0)[bl]{\tikz{\draw[-latex, line width=1pt](0,0)--(0.45,0.45);}}}} + \put(4.00,2.60){\only<5>{\makebox(0,0)[b]{\lstinline{pop ()}: 7}}} + + \put(3.55,1.05){\only<6>{\makebox(0,0)[bl]{\tikz{\draw[-latex, line width=1pt](0,0)--(0.45,0.45);}}}} + \put(4.00,1.60){\only<6>{\makebox(0,0)[b]{\lstinline{pop ()}: 3}}} + \end{picture} + + \bigskip + + LIFO = Stack = Stapel + \end{center} + \end{minipage} + +% +% \dots + +\end{frame} + +\begin{frame} + + \showsection + \showsubsection + + \bigskip + + \begin{minipage}[t]{6cm} + Array (Stack, FIFO):\\ + in der Mitte einfügen + \begin{center} + \begin{picture}(6,3.8) + \thicklines + \color{structure} + \put(1.5,0){\line(1,0){3}} + + \put(2.5,0){\line(0,1){3}} + \put(3.5,0){\line(0,1){3}} + \put(2.5,1){\line(1,0){1}} + \put(3.0,0.5){\makebox(0,0){\lstinline{3}}} + \put(2.5,1){\line(1,0){1}} + \put(3.0,1.5){\makebox(0,0){\lstinline{7}}} + \put(2.5,2){\line(1,0){1}} + \put(3.0,2.5){\makebox(0,0){\lstinline{137}}} + \put(2.5,3){\line(1,0){1}} + + \put(1.5,1.5){\makebox(0,0)[b]{\lstinline{push (5)}}} + \put(1.5,1.45){\makebox(0,0)[tl]{\tikz{\draw[-latex, line width=1pt](0,0)--(0.95,-0.45);}}} + + \put(3.55,2.5){\makebox(0,0)[bl]{\tikz{\draw[-latex, line width=1pt](0,0)..controls(0.5,0.45)..(0,0.9);}}} + \put(3.55,1.5){\makebox(0,0)[bl]{\tikz{\draw[-latex, line width=1pt](0,0)..controls(0.5,0.45)..(0,0.9);}}} + + \pause + \color{red} + \put(4.1,3.0){\makebox(0,0)[l]{\textbf{1.}}} + \put(4.1,2.0){\makebox(0,0)[l]{\textbf{2.}}} + \put(1.5,1.9){\makebox(0,0)[b]{\textbf{3.}}} + + \pause + \put(6.0,1.5){\makebox(0,0)[tl]{$\mathcal{O}(n)$}} + \put(5.95,1.45){\makebox(0,0)[br]{\tikz{\draw[-latex](0,0)--(-1.3,0.4);}}} + \put(5.95,1.49){\makebox(0,0)[br]{\tikz{\draw[-latex](0,0)--(-1.3,1.1);}}} + \end{picture} + \end{center} + \end{minipage}\pause\hfill + \begin{minipage}[t]{5cm} + In Array (Stack, FIFO) \dots + \begin{itemize} + \item + einfügen: $\mathcal{O}(n)$ + \item + suchen: $\mathcal{O}(n)$ + \item + geschickt suchen: $\mathcal{O}(\log n)$ + \item + beim Einfügen sortieren:\\ + $\mathcal{O}(n \log n)$ \hspace*{-1.8cm}\tikz{\draw[red](-1.8,0)--(0,0.2);\draw[red](-1.8,0.2)--(0,0);} + $\mathcal{O}(n^2)$ + \end{itemize} + \end{minipage} + +\end{frame} + +\subsection{Verkettete Listen} + +\begin{frame} + + \showsection + \showsubsection + + \begin{tikzpicture} + \color{structure} + \node(first) at (0,0.5) {first}; + \node[shape=rectangle,draw,line width=1pt](3) at (1,2) {3}; + \node[shape=rectangle,draw,line width=1pt](5) at (2,1) {5}; + \node[shape=rectangle,draw,line width=1pt](7) at (3,2) {7}; + \node[shape=rectangle,draw,line width=1pt](137) at (5,2) {137}; + \node(NULL) at (7,2) {NULL}; + \draw[-latex](first)--(3); + \only<1>{\draw[-latex](3)--(7);} + \only<2>{\draw[-latex](3) to[out=0] (5);} + \only<2>{\draw[-latex](5) to[in=180] (7);} + \draw[-latex](7)--(137); + \draw[-latex](137)--(NULL); + \end{tikzpicture} + \begin{itemize} + \item + Jeder Datensatz enthält einen Zeiger auf das nächste Element. + \item + Beim letzten Element zeigt der Zeiger auf \lstinline{NULL}. + \item + Eine Variable zeigt auf das erste Element. + \item + Wenn die Liste leer ist, zeigt die Variable auf \lstinline{NULL}. + \arrowitem + (einfach) \textbf{verkettete Liste} + \end{itemize} + +\end{frame} + +\begin{frame} + + \showsection + \showsubsection + + \begin{minipage}[t]{5cm} + In Array (Stack, FIFO) \dots + \begin{itemize} + \item + in der Mitte einfügen: $\mathcal{O}(n)$ + \item + wahlfreier Zugriff: $\mathcal{O}(1)$ + \item + suchen: $\mathcal{O}(n)$ + \item + geschickt suchen: $\mathcal{O}(\log n)$ + \item + beim Einfügen sortieren:\\ + $\mathcal{O}(n \log n)$ \hspace*{-1.8cm}\tikz{\draw[red](-1.8,0)--(0,0.2);\draw[red](-1.8,0.2)--(0,0);} + $\mathcal{O}(n^2)$ + \end{itemize} + \end{minipage}\hfill + \begin{minipage}[t]{6cm} + In (einfach) verkettete/r Liste \dots + \begin{itemize} + \item + in der Mitte einfügen: $\mathcal{O}(1)$ + \item + wahlfreier Zugriff: $\mathcal{O}(n)$ + \item + suchen: $\mathcal{O}(n)$ + \item + geschickt \hspace*{-1.7cm}\tikz{\draw[red](-1.7,0)--(0,0.2);\draw[red](-1.7,0.2)--(0,0);} + suchen: {\color{red}$\mathcal{O}(n)$} + \item + beim Einfügen sortieren: + $\mathcal{O}(n \log n)$ \hspace*{-1.8cm}\tikz{\draw[red](-1.8,0)--(0,0.2);\draw[red](-1.8,0.2)--(0,0);} + $\mathcal{O}(n^2)$ + \end{itemize} + \end{minipage} + \pause + \medskip + \begin{center} + \begin{minipage}[t]{6cm} + In (ausbalancierten) Bäumen \dots + \begin{itemize} + \item + in der Mitte einfügen: $\mathcal{O}(\log n)$ + \item + wahlfreier Zugriff: $\mathcal{O}(\log n)$ + \item + suchen: $\mathcal{O}(\log n)$ + \item + beim Einfügen sortieren: + $\mathcal{O}(n \log n)$ + \end{itemize} + \end{minipage} + \end{center} + \vspace*{-1cm} + +\end{frame} + +\subsection{Bäume} + +\begin{frame}[fragile] + + \showsection + \showsubsection + + \begin{minipage}[t]{5cm} + \vspace*{-6cm} + \begin{lstlisting}[gobble=6] + ¡typedef struct node + { + int content; + struct node *left, *right; + } node;¿ + \end{lstlisting} + \bigskip + \bigskip + \begin{onlyenv}<6-> + \begin{itemize} + \item + Einfügen: rekursiv, $\mathcal{O}(\log n)$ + \item + Suchen: rekursiv, $\mathcal{O}(\log n)$ + \item + beim Einfügen sortieren:\\ + rekursiv, $\mathcal{O}(n\log n)$ + \begin{onlyenv}<7-> + \smallskip + \item + {\color{red} + \emph{Worst Case\/}: $\mathcal{O}(n^2)$\\ + vorher bereits sortiert}\\ + \textarrow\ balancierte Bäume\\ + \hspace*{2.15em}Anwendung: Datenbanken\hspace*{-2cm} + \end{onlyenv} + \end{itemize} + \vspace*{-1cm} + \end{onlyenv} + \end{minipage}\hfill + \begin{minipage}[t]{7cm} + \begin{center} + \begin{tikzpicture} + \color{structure} + \node(root) at (0,0) {\lstinline{node *root;}}; + \begin{onlyenv}<2> + \node(3) at (-2,-3) {\lstinline{NULL}}; + \node(137) at (2,-3) {\lstinline{NULL}}; + \end{onlyenv} + \begin{onlyenv}<2-> + \node[shape=rectangle,draw,line width=1pt](7) at (0,-1.5) {7}; + \draw[-latex](root)--(7); + \draw[-latex](7)--(3); + \draw[-latex](7)--(137); + \end{onlyenv} + \begin{onlyenv}<3> + \node(3) at (-2,-3) {\lstinline{NULL}}; + \end{onlyenv} + \begin{onlyenv}<3-> + \node[shape=rectangle,draw,line width=1pt](137) at (2,-3) {137}; + \node(137_left) at (1,-4.5) {\lstinline{NULL}}; + \node(137_right) at (3,-4.5) {\lstinline{NULL}}; + \draw[-latex](137)--(137_left); + \draw[-latex](137)--(137_right); + \end{onlyenv} + \begin{onlyenv}<4> + \node(5) at (-1,-4.5) {\lstinline{NULL}}; + \end{onlyenv} + \begin{onlyenv}<4-> + \node[shape=rectangle,draw,line width=1pt](3) at (-2,-3) {3}; + \node(3_left) at (-3,-4.5) {\lstinline{NULL}}; + \draw[-latex](3)--(3_left); + \draw[-latex](3)--(5); + \end{onlyenv} + \begin{onlyenv}<5-> + \node[shape=rectangle,draw,line width=1pt](5) at (-1,-4.5) {5}; + \node(5_left) at (-2,-6) {\lstinline{NULL}}; + \node(5_right) at (0,-6) {\lstinline{NULL}}; + \draw[-latex](5)--(5_left); + \draw[-latex](5)--(5_right); + \end{onlyenv} + \end{tikzpicture} + \end{center} + \end{minipage} + +\end{frame} + +\nosectionnonumber{\inserttitle} + +\begin{frame} + + \shownosectionnonumber + + \begin{itemize} + \item[\textbf{1}] \textbf{Einführung} + \hfill\makebox(0,0)[br]{\raisebox{2.25ex}{\url{https://gitlab.cvh-server.de/pgerwinski/hp}}} + \item[\textbf{2}] \textbf{Einführung in C} + \item[\textbf{3}] \textbf{Bibliotheken} + \item[\textbf{4}] \textbf{Hardwarenahe Programmierung} + \item[\textbf{5}] \textbf{Algorithmen} + \item[\textbf{6}] \textbf{Objektorientierte Programmierung} + \begin{itemize} + \vspace*{-\smallskipamount} + \item[\dots] + \item[6.3] Unions + \item[6.4] Virtuelle Methoden + \color{medgreen} + \item[6.5] Beispiel: Graphische Benutzeroberfläche (GUI) + \item[6.6] Ausblick: C++ + \end{itemize} + \item[\textbf{7}] \textbf{Datenstrukturen} + \begin{itemize} + \color{medgreen} + \item[7.1] Stack und FIFO + \item[7.2] Verkettete Listen + \item[7.3] Bäume + \end{itemize} + \end{itemize} + \vspace*{-1.5cm} + \begin{flushright} + \rightskip 2cm + \large + \em + \color{orange}% + Viel Erfolg\hspace*{0.25cm}\strut\\ + in der Klausur! + \end{flushright} + +\end{frame} + +\end{document} diff --git a/20200123/hp-uebung-20200123.pdf b/20200123/hp-uebung-20200123.pdf index 2fee05b9b3d4cf6ab2ae29220087e994c5d85adf..58efe2878f69459f4b76787c574c9257212cc9ba 100644 Binary files a/20200123/hp-uebung-20200123.pdf and b/20200123/hp-uebung-20200123.pdf differ diff --git a/20200123/hp-uebung-20200123.tex b/20200123/hp-uebung-20200123.tex index 245ef3b0d3277f8218d540b7b1089866ba454b6a..d94c7c93e461098bbf2560667162055754f4c02f 100644 --- a/20200123/hp-uebung-20200123.tex +++ b/20200123/hp-uebung-20200123.tex @@ -40,7 +40,7 @@ \exercise{Stack-Operationen} - Das folgende Programm (\gitfile{hp}{20190121}{aufgabe-1.c}) + Das folgende Programm (\gitfile{hp}{20200123}{aufgabe-1.c}) implementiert einen Stapelspeicher (Stack). Dies ist ein Array, das nur bis zu einer variablen Obergrenze (Stack-Pointer) tatsächlich genutzt wird. @@ -141,7 +141,7 @@ \exercise{Iterationsfunktionen} - Wir betrachten das folgende Programm (\gitfile{hp}{20190114}{aufgabe-2.c}): + Wir betrachten das folgende Programm (\gitfile{hp}{20200123}{aufgabe-2.c}): \begin{minipage}[t]{0.4\textwidth} \begin{lstlisting}[gobble=6] diff --git a/20200123/pgslides.sty b/20200123/pgslides.sty new file mode 120000 index 0000000000000000000000000000000000000000..da062f7454c898ca1bc89bc29f268d9f00b21e5b --- /dev/null +++ b/20200123/pgslides.sty @@ -0,0 +1 @@ +../20200102/pgslides.sty \ No newline at end of file