Update README: Modul 0, C++ Examples, Checkpoints, Final Project
This commit is contained in:
192
README.md
192
README.md
@@ -7,7 +7,7 @@
|
|||||||
Dieses Repository enthält einen kompletten Kurs für Programmieranfänger mit C-Grundlagen, der sich auf **sprachunabhängige Konzepte** konzentriert.
|
Dieses Repository enthält einen kompletten Kurs für Programmieranfänger mit C-Grundlagen, der sich auf **sprachunabhängige Konzepte** konzentriert.
|
||||||
|
|
||||||
**Zielgruppe:** Student mit C-Erfahrung, geplantem C++-Umstieg
|
**Zielgruppe:** Student mit C-Erfahrung, geplantem C++-Umstieg
|
||||||
**Kursdauer:** 8 Wochen
|
**Kursdauer:** 8 Wochen + Setup
|
||||||
**Lernziel:** Konzepte verstehen, die auf jede Programmiersprache übertragbar sind
|
**Lernziel:** Konzepte verstehen, die auf jede Programmiersprache übertragbar sind
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -21,24 +21,34 @@ Dieses Repository enthält einen kompletten Kurs für Programmieranfänger mit C
|
|||||||
│ ├── programming-concepts-universal.md # Hauptkurs-Dokument
|
│ ├── programming-concepts-universal.md # Hauptkurs-Dokument
|
||||||
│ └── quiz-fragen.md # Interaktive Quizfragen
|
│ └── quiz-fragen.md # Interaktive Quizfragen
|
||||||
├── src/
|
├── src/
|
||||||
│ └── c_examples/ # C Code-Beispiele
|
│ ├── c_examples/ # C Code-Beispiele
|
||||||
│ ├── module1_memory.c
|
│ │ ├── module0_setup.c # 🆕 Entwicklungsumgebung
|
||||||
│ ├── module2_datatypes.c
|
│ │ ├── module1_memory.c
|
||||||
│ ├── module3_controlflow.c
|
│ │ ├── module2_datatypes.c
|
||||||
│ ├── module4_functions.c
|
│ │ ├── module3_controlflow.c
|
||||||
│ ├── module5_datastructures.c
|
│ │ ├── module4_functions.c
|
||||||
│ ├── module6_pointers.c
|
│ │ ├── module5_datastructures.c
|
||||||
│ ├── module7_oop_in_c.c
|
│ │ ├── module6_pointers.c
|
||||||
│ ├── module8_modularization.c
|
│ │ ├── module7_oop_in_c.c
|
||||||
│ ├── Makefile
|
│ │ ├── module8_modularization.c
|
||||||
|
│ │ ├── Makefile
|
||||||
|
│ │ └── README.md
|
||||||
|
│ └── cpp_examples/ # 🆕 C++ Vergleichsbeispiele
|
||||||
|
│ ├── module1_memory_cpp.cpp # Smart Pointers, RAII
|
||||||
|
│ ├── module5_datastructures_cpp.cpp # STL Container
|
||||||
|
│ ├── module7_oop_cpp.cpp # Klassen, Vererbung
|
||||||
|
│ ├── module8_stl_cpp.cpp # 🆕 Iteratoren, Lambdas
|
||||||
│ └── README.md
|
│ └── README.md
|
||||||
└── exercises/
|
└── exercises/
|
||||||
├── checkpoint_a.c # Memory & Typen
|
│ ├── checkpoint_a.c # 🆕 Lösung: Memory & Typen
|
||||||
├── checkpoint_b.c # Taschenrechner
|
│ ├── checkpoint_b.c # 🆕 Lösung: Taschenrechner
|
||||||
├── checkpoint_c.c # Dynamische Liste
|
│ ├── checkpoint_c.c # 🆕 Lösung: Dynamische Liste
|
||||||
└── final_project/ # Todo-App
|
│ └── final_project/ # 🆕 Abschlussprojekt
|
||||||
├── todo_c/
|
│ ├── README.md
|
||||||
└── todo_cpp/
|
│ ├── todo_c/
|
||||||
|
│ │ └── todo.c # C-Implementierung
|
||||||
|
│ └── todo_cpp/
|
||||||
|
│ └── todo.cpp # C++-Implementierung
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -47,14 +57,15 @@ Dieses Repository enthält einen kompletten Kurs für Programmieranfänger mit C
|
|||||||
|
|
||||||
| Modul | Thema | C-Beispiel | C++-Gegenstück |
|
| Modul | Thema | C-Beispiel | C++-Gegenstück |
|
||||||
|-------|-------|------------|----------------|
|
|-------|-------|------------|----------------|
|
||||||
| 1 | **Memory-Modell** | `malloc/free` | `new/delete`, Smart Pointer |
|
| **0** | **Setup** | `module0_setup.c` | - |
|
||||||
| 2 | **Datentypen** | `int32_t`, Overflow | `auto`, `constexpr` |
|
| **1** | **Memory-Modell** | `module1_memory.c` | `module1_memory_cpp.cpp` |
|
||||||
| 3 | **Flusskontrolle** | `if/for/while` | Gleich |
|
| **2** | **Datentypen** | `module2_datatypes.c` | (Konzepte ähnlich) |
|
||||||
| 4 | **Funktionen** | Call-by-Value | References, `&` |
|
| **3** | **Flusskontrolle** | `module3_controlflow.c` | (Konzepte identisch) |
|
||||||
| 5 | **Datenstrukturen** | LinkedList, Stack | STL: `vector`, `stack` |
|
| **4** | **Funktionen** | `module4_functions.c` | (Konzepte ähnlich) |
|
||||||
| 6 | **Pointer** | `*`, `&`, Arithmetik | References, Smart Ptr |
|
| **5** | **Datenstrukturen** | `module5_datastructures.c` | `module5_datastructures_cpp.cpp` |
|
||||||
| 7 | **OOP** | Structs + Fct Ptrs | `class`, `virtual` |
|
| **6** | **Pointer** | `module6_pointers.c` | References, Smart Pointers |
|
||||||
| 8 | **Modularisierung** | MVC-Pattern | Namespaces, Templates |
|
| **7** | **OOP** | `module7_oop_in_c.c` | `module7_oop_cpp.cpp` |
|
||||||
|
| **8** | **Modularisierung** | `module8_modularization.c` | `module8_stl_cpp.cpp` |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -75,7 +86,7 @@ make --version
|
|||||||
### Kompilieren
|
### Kompilieren
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Alle C-Beispiele kompilieren
|
# Alle C-Beispiele
|
||||||
cd src/c_examples
|
cd src/c_examples
|
||||||
make all
|
make all
|
||||||
|
|
||||||
@@ -83,9 +94,15 @@ make all
|
|||||||
make module1
|
make module1
|
||||||
./module1
|
./module1
|
||||||
|
|
||||||
# Mit Debugging
|
# C++ Beispiele
|
||||||
make CFLAGS="-g -O0" module1
|
cd ../cpp_examples
|
||||||
gdb ./module1
|
g++ -std=c++17 -o memory module1_memory_cpp.cpp
|
||||||
|
./memory
|
||||||
|
|
||||||
|
# Final-Projekt
|
||||||
|
cd ../../exercises/final_project/todo_c
|
||||||
|
gcc -o todo todo.c -Wall -Wextra
|
||||||
|
./todo
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -94,29 +111,35 @@ gdb ./module1
|
|||||||
|
|
||||||
### Empfohlener Lernpfad
|
### Empfohlener Lernpfad
|
||||||
|
|
||||||
**Woche 1-2:**
|
**Vorbereitung (Modul 0):**
|
||||||
|
1. Lese `src/c_examples/module0_setup.c`
|
||||||
|
2. Installiere VS Code, GCC, Git
|
||||||
|
3. Erstelle erstes "Hello World" Programm
|
||||||
|
4. Initialisiere Git-Repository
|
||||||
|
|
||||||
|
**Woche 1-2 (Modul 1-2):**
|
||||||
1. Lese `docs/programming-concepts-universal.md` Modul 1-2
|
1. Lese `docs/programming-concepts-universal.md` Modul 1-2
|
||||||
2. Bearbeite `docs/quiz-fragen.md` Fragen 1.1-2.3
|
2. Bearbeite `docs/quiz-fragen.md` Fragen 1.1-2.3
|
||||||
3. Kompiliere und teste `module1_memory.c` & `module2_datatypes.c`
|
3. Kompiliere und teste `module1_memory.c` & `module2_datatypes.c`
|
||||||
4. ✅ Checkpoint A bestehen
|
4. ✅ **Checkpoint A**: Lösung in `exercises/checkpoint_a.c` vergleichen
|
||||||
|
|
||||||
**Woche 3-4:**
|
**Woche 3-4 (Modul 3-4):**
|
||||||
1. Modul 3-4 lesen
|
1. Modul 3-4 lesen
|
||||||
2. Quizfragen 3.1-4.3
|
2. Quizfragen 3.1-4.3
|
||||||
3. Code-Beispiele: `module3_controlflow.c`, `module4_functions.c`
|
3. Code-Beispiele: `module3_controlflow.c`, `module4_functions.c`
|
||||||
4. 📝 Checkpoint B: Taschenrechner implementieren
|
4. 📝 **Checkpoint B**: Taschenrechner implementieren, mit `checkpoint_b.c` vergleichen
|
||||||
|
|
||||||
**Woche 5-6:**
|
**Woche 5-6 (Modul 5-6):**
|
||||||
1. Modul 5-6 lesen
|
1. Modul 5-6 lesen
|
||||||
2. Quizfragen 5.1-6.3
|
2. Quizfragen 5.1-6.3
|
||||||
3. Code: `module5_datastructures.c`, `module6_pointers.c`
|
3. Code: `module5_datastructures.c`, `module6_pointers.c`
|
||||||
4. 🔧 Checkpoint C: Eigene LinkedList implementieren
|
4. 🔧 **Checkpoint C**: Eigene LinkedList implementieren, mit `checkpoint_c.c` vergleichen
|
||||||
|
|
||||||
**Woche 7-8:**
|
**Woche 7-8 (Modul 7-8):**
|
||||||
1. Modul 7-8 lesen
|
1. Modul 7-8 lesen
|
||||||
2. Quizfragen 7.1-8.3 + Final
|
2. Quizfragen 7.1-8.3 + Final
|
||||||
3. Code: `module7_oop_in_c.c` + C++ Vergleich
|
3. Code: `module7_oop_in_c.c` + C++ Vergleich (`module7_oop_cpp.cpp`)
|
||||||
4. 🎓 Final-Projekt: Todo-App in C, dann C++
|
4. 🎓 **Final-Projekt**: Todo-App in C, dann C++ (`exercises/final_project/`)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -138,6 +161,45 @@ Das Kursmaterial enthält **28 Quizfragen** mit:
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## 🎯 Checkpoints (mit Lösungen)
|
||||||
|
|
||||||
|
| Checkpoint | Thema | Datei | Schwierigkeit |
|
||||||
|
|------------|-------|-------|---------------|
|
||||||
|
| **A** | Memory & Typen | `exercises/checkpoint_a.c` | ⭐ Mittel |
|
||||||
|
| **B** | Taschenrechner | `exercises/checkpoint_b.c` | ⭐⭐ Fortgeschritten |
|
||||||
|
| **C** | Dynamische Liste | `exercises/checkpoint_c.c` | ⭐⭐⭐ Experte |
|
||||||
|
|
||||||
|
Jeder Checkpoint enthält:
|
||||||
|
- Aufgabenstellung als Kommentar
|
||||||
|
- Vollständige Lösung
|
||||||
|
- Erklärungen der Konzepte
|
||||||
|
- Test-Funktionen
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🏆 Final-Projekt: Todo-App
|
||||||
|
|
||||||
|
Vollständige CRUD-Anwendung mit:
|
||||||
|
- **C-Version**: Manuelle Speicherverwaltung, structs
|
||||||
|
- **C++-Version**: Klassen, STL, Smart Pointers
|
||||||
|
|
||||||
|
**Features:**
|
||||||
|
- Todo hinzufügen/ansehen/abschließen/löschen
|
||||||
|
- Datei-Speicherung
|
||||||
|
- Menü-System
|
||||||
|
- Fehlerbehandlung
|
||||||
|
|
||||||
|
**Vergleich C vs C++:**
|
||||||
|
| Aspekt | C | C++ |
|
||||||
|
|--------|---|-----|
|
||||||
|
| Codezeilen | ~300 | ~250 |
|
||||||
|
| Speicherverwaltung | Manuell (malloc/free) | RAII (destruktoren) |
|
||||||
|
| Datenstruktur | Struct + Funktionen | Klasse mit Methoden |
|
||||||
|
| String-Handling | char[] (manuell) | std::string |
|
||||||
|
| Fehlerbehandlung | Return codes | Exceptions (optional) |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## 💡 Kernkonzepte
|
## 💡 Kernkonzepte
|
||||||
|
|
||||||
### 1. Memory-Modell (Universell)
|
### 1. Memory-Modell (Universell)
|
||||||
@@ -170,53 +232,13 @@ Das Kursmaterial enthält **28 Quizfragen** mit:
|
|||||||
|
|
||||||
| Feature | C | C++ |
|
| Feature | C | C++ |
|
||||||
|---------|---|-----|
|
|---------|---|-----|
|
||||||
| Memory | `malloc/free` | `new/delete`, RAII |
|
| Memory | `malloc/free` | `new/delete`, RAII, Smart Pointers |
|
||||||
| Strings | `char[]` | `std::string` |
|
| Strings | `char[]` | `std::string` |
|
||||||
| Arrays | Fixed/dynamisch | `std::vector` |
|
| Arrays | Fixed/dynamisch | `std::vector` |
|
||||||
| OOP | Simuliert | Nativ (`class`) |
|
| OOP | Simuliert (structs + fct ptrs) | Nativ (`class`, `virtual`) |
|
||||||
| Generics | `void*` | `template<T>` |
|
| Generics | `void*` | `template<T>` |
|
||||||
| Module | Header | Namespaces |
|
| Algorithmen | Manuell implementieren | 100+ STL-Algorithmen |
|
||||||
|
| Iteratoren | Manuell (Index/Pointers) | Einheitlich für alle Container |
|
||||||
---
|
|
||||||
|
|
||||||
## 📝 Checkpoints
|
|
||||||
|
|
||||||
### Checkpoint A (nach Modul 2)
|
|
||||||
```c
|
|
||||||
// Frage: Was ist der Output?
|
|
||||||
void test() {
|
|
||||||
int x = 42;
|
|
||||||
int *p = &x;
|
|
||||||
// Was ist p nach Ende von test()?
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Checkpoint B (nach Modul 4)
|
|
||||||
Erstelle einen Taschenrechner mit:
|
|
||||||
- Menü-System (if/switch)
|
|
||||||
- Mathematische Funktionen
|
|
||||||
- Rekursive Fakultät
|
|
||||||
- Fehlerbehandlung
|
|
||||||
|
|
||||||
### Checkpoint C (nach Modul 6)
|
|
||||||
Implementiere eine dynamische Liste:
|
|
||||||
```c
|
|
||||||
typedef struct {
|
|
||||||
int* data;
|
|
||||||
int size;
|
|
||||||
int capacity;
|
|
||||||
} Vector;
|
|
||||||
|
|
||||||
void vector_push(Vector* v, int value);
|
|
||||||
int vector_get(Vector* v, int index);
|
|
||||||
```
|
|
||||||
|
|
||||||
### Final-Projekt
|
|
||||||
**Todo-App** mit:
|
|
||||||
1. CRUD-Operationen
|
|
||||||
2. File-Speicherung
|
|
||||||
3. CLI-Interface
|
|
||||||
4. Modularer Architektur
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -227,15 +249,13 @@ int vector_get(Vector* v, int index);
|
|||||||
- **"C++ Primer"** (Lippman) - Umfassend
|
- **"C++ Primer"** (Lippman) - Umfassend
|
||||||
- **"Clean Code"** (Robert C. Martin) - Sprachunabhängig!
|
- **"Clean Code"** (Robert C. Martin) - Sprachunabhängig!
|
||||||
- **"Design Patterns"** (Gang of Four) - Das Original
|
- **"Design Patterns"** (Gang of Four) - Das Original
|
||||||
|
- **"The C++ Standard Library"** (Nicolai Josuttis) - STL Referenz
|
||||||
|
|
||||||
### Online
|
### Online
|
||||||
- [exercism.org](https://exercism.org) - Sprachübergreifende Übungen
|
- [exercism.org](https://exercism.org) - Sprachübergreifende Übungen
|
||||||
- [leetcode.com](https://leetcode.com) - Algorithmen
|
- [leetcode.com](https://leetcode.com) - Algorithmen
|
||||||
- [codewars.com](https://codewars.com) - Katas
|
- [codewars.com](https://codewars.com) - Katas
|
||||||
|
- [cppreference.com](https://cppreference.com) - C/C++ Dokumentation
|
||||||
### Dokumentation
|
|
||||||
- [C Reference](https://en.cppreference.com/w/c)
|
|
||||||
- [C++ Reference](https://en.cppreference.com/w/cpp)
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user