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.
|
||||
|
||||
**Zielgruppe:** Student mit C-Erfahrung, geplantem C++-Umstieg
|
||||
**Kursdauer:** 8 Wochen
|
||||
**Kursdauer:** 8 Wochen + Setup
|
||||
**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
|
||||
│ └── quiz-fragen.md # Interaktive Quizfragen
|
||||
├── src/
|
||||
│ └── c_examples/ # C Code-Beispiele
|
||||
│ ├── module1_memory.c
|
||||
│ ├── module2_datatypes.c
|
||||
│ ├── module3_controlflow.c
|
||||
│ ├── module4_functions.c
|
||||
│ ├── module5_datastructures.c
|
||||
│ ├── module6_pointers.c
|
||||
│ ├── module7_oop_in_c.c
|
||||
│ ├── module8_modularization.c
|
||||
│ ├── Makefile
|
||||
│ ├── c_examples/ # C Code-Beispiele
|
||||
│ │ ├── module0_setup.c # 🆕 Entwicklungsumgebung
|
||||
│ │ ├── module1_memory.c
|
||||
│ │ ├── module2_datatypes.c
|
||||
│ │ ├── module3_controlflow.c
|
||||
│ │ ├── module4_functions.c
|
||||
│ │ ├── module5_datastructures.c
|
||||
│ │ ├── module6_pointers.c
|
||||
│ │ ├── module7_oop_in_c.c
|
||||
│ │ ├── 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
|
||||
└── exercises/
|
||||
├── checkpoint_a.c # Memory & Typen
|
||||
├── checkpoint_b.c # Taschenrechner
|
||||
├── checkpoint_c.c # Dynamische Liste
|
||||
└── final_project/ # Todo-App
|
||||
├── todo_c/
|
||||
└── todo_cpp/
|
||||
│ ├── checkpoint_a.c # 🆕 Lösung: Memory & Typen
|
||||
│ ├── checkpoint_b.c # 🆕 Lösung: Taschenrechner
|
||||
│ ├── checkpoint_c.c # 🆕 Lösung: Dynamische Liste
|
||||
│ └── final_project/ # 🆕 Abschlussprojekt
|
||||
│ ├── README.md
|
||||
│ ├── 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 |
|
||||
|-------|-------|------------|----------------|
|
||||
| 1 | **Memory-Modell** | `malloc/free` | `new/delete`, Smart Pointer |
|
||||
| 2 | **Datentypen** | `int32_t`, Overflow | `auto`, `constexpr` |
|
||||
| 3 | **Flusskontrolle** | `if/for/while` | Gleich |
|
||||
| 4 | **Funktionen** | Call-by-Value | References, `&` |
|
||||
| 5 | **Datenstrukturen** | LinkedList, Stack | STL: `vector`, `stack` |
|
||||
| 6 | **Pointer** | `*`, `&`, Arithmetik | References, Smart Ptr |
|
||||
| 7 | **OOP** | Structs + Fct Ptrs | `class`, `virtual` |
|
||||
| 8 | **Modularisierung** | MVC-Pattern | Namespaces, Templates |
|
||||
| **0** | **Setup** | `module0_setup.c` | - |
|
||||
| **1** | **Memory-Modell** | `module1_memory.c` | `module1_memory_cpp.cpp` |
|
||||
| **2** | **Datentypen** | `module2_datatypes.c` | (Konzepte ähnlich) |
|
||||
| **3** | **Flusskontrolle** | `module3_controlflow.c` | (Konzepte identisch) |
|
||||
| **4** | **Funktionen** | `module4_functions.c` | (Konzepte ähnlich) |
|
||||
| **5** | **Datenstrukturen** | `module5_datastructures.c` | `module5_datastructures_cpp.cpp` |
|
||||
| **6** | **Pointer** | `module6_pointers.c` | References, Smart Pointers |
|
||||
| **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
|
||||
|
||||
```bash
|
||||
# Alle C-Beispiele kompilieren
|
||||
# Alle C-Beispiele
|
||||
cd src/c_examples
|
||||
make all
|
||||
|
||||
@@ -83,9 +94,15 @@ make all
|
||||
make module1
|
||||
./module1
|
||||
|
||||
# Mit Debugging
|
||||
make CFLAGS="-g -O0" module1
|
||||
gdb ./module1
|
||||
# C++ Beispiele
|
||||
cd ../cpp_examples
|
||||
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
|
||||
|
||||
**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
|
||||
2. Bearbeite `docs/quiz-fragen.md` Fragen 1.1-2.3
|
||||
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
|
||||
2. Quizfragen 3.1-4.3
|
||||
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
|
||||
2. Quizfragen 5.1-6.3
|
||||
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
|
||||
2. Quizfragen 7.1-8.3 + Final
|
||||
3. Code: `module7_oop_in_c.c` + C++ Vergleich
|
||||
4. 🎓 Final-Projekt: Todo-App in C, dann C++
|
||||
3. Code: `module7_oop_in_c.c` + C++ Vergleich (`module7_oop_cpp.cpp`)
|
||||
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
|
||||
|
||||
### 1. Memory-Modell (Universell)
|
||||
@@ -170,53 +232,13 @@ Das Kursmaterial enthält **28 Quizfragen** mit:
|
||||
|
||||
| Feature | C | C++ |
|
||||
|---------|---|-----|
|
||||
| Memory | `malloc/free` | `new/delete`, RAII |
|
||||
| Memory | `malloc/free` | `new/delete`, RAII, Smart Pointers |
|
||||
| Strings | `char[]` | `std::string` |
|
||||
| Arrays | Fixed/dynamisch | `std::vector` |
|
||||
| OOP | Simuliert | Nativ (`class`) |
|
||||
| OOP | Simuliert (structs + fct ptrs) | Nativ (`class`, `virtual`) |
|
||||
| Generics | `void*` | `template<T>` |
|
||||
| Module | Header | Namespaces |
|
||||
|
||||
---
|
||||
|
||||
## 📝 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
|
||||
| Algorithmen | Manuell implementieren | 100+ STL-Algorithmen |
|
||||
| Iteratoren | Manuell (Index/Pointers) | Einheitlich für alle Container |
|
||||
|
||||
---
|
||||
|
||||
@@ -227,15 +249,13 @@ int vector_get(Vector* v, int index);
|
||||
- **"C++ Primer"** (Lippman) - Umfassend
|
||||
- **"Clean Code"** (Robert C. Martin) - Sprachunabhängig!
|
||||
- **"Design Patterns"** (Gang of Four) - Das Original
|
||||
- **"The C++ Standard Library"** (Nicolai Josuttis) - STL Referenz
|
||||
|
||||
### Online
|
||||
- [exercism.org](https://exercism.org) - Sprachübergreifende Übungen
|
||||
- [leetcode.com](https://leetcode.com) - Algorithmen
|
||||
- [codewars.com](https://codewars.com) - Katas
|
||||
|
||||
### Dokumentation
|
||||
- [C Reference](https://en.cppreference.com/w/c)
|
||||
- [C++ Reference](https://en.cppreference.com/w/cpp)
|
||||
- [cppreference.com](https://cppreference.com) - C/C++ Dokumentation
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user